Skip to content

Commit ecd72c3

Browse files
authored
Push image to GHCR on release or master update (#217)
resolves #214 Signed-off-by: Peter Engelbert <[email protected]>
1 parent 1f2ee9d commit ecd72c3

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

.github/workflows/release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
tags:
8+
- v*
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v2
16+
- name: setup go environment
17+
uses: actions/setup-go@v1
18+
with:
19+
go-version: '1.15.6'
20+
- name: Prepare
21+
id: prepare
22+
run: |
23+
VERSION=${GITHUB_REF#refs/*/}
24+
BRANCH_NAME=${GITHUB_REF#refs/heads/}
25+
if [[ "${VERSION}" == "${BRANCH_NAME}" ]]; then
26+
VERSION=$(git rev-parse --short HEAD)
27+
fi
28+
echo ::set-output name=version::${VERSION}
29+
echo ::set-output name=ref::ghcr.io/${{ github.repository }}/conformance:${VERSION}
30+
- name: Docker Build
31+
run: |
32+
docker build \
33+
--build-arg VERSION=${{ steps.prepare.outputs.version }} \
34+
-t ${{ steps.prepare.outputs.ref }} \
35+
conformance/
36+
- name: Docker Login
37+
uses: docker/login-action@v1
38+
with:
39+
registry: ghcr.io
40+
username: ${{ secrets.GHCR_USER }}
41+
password: ${{ secrets.GHCR_TOKEN }}
42+
- name: Docker Push
43+
run: |
44+
docker push ${{ steps.prepare.outputs.ref }}
45+
- name: Clear
46+
if: always()
47+
run: |
48+
rm -f ${HOME}/.docker/config.json

action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ inputs: {}
88
outputs: {}
99
runs:
1010
using: docker
11+
# TODO: change to "docker://ghcr.io/opencontainers/distribution-spec/conformance:<TAG>"
1112
image: conformance/Dockerfile

0 commit comments

Comments
 (0)