forked from opencontainers/distribution-spec
-
Notifications
You must be signed in to change notification settings - Fork 1
48 lines (46 loc) · 1.29 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: release
on:
push:
branches:
- main
tags:
- v*
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: setup go environment
uses: actions/setup-go@v1
with:
go-version: '1.16.2'
- name: Prepare
id: prepare
run: |
VERSION=${GITHUB_REF#refs/*/}
BRANCH_NAME=${GITHUB_REF#refs/heads/}
if [[ "${VERSION}" == "${BRANCH_NAME}" ]]; then
VERSION=$(git rev-parse --short HEAD)
fi
echo ::set-output name=version::${VERSION}
echo ::set-output name=ref::ghcr.io/${{ github.repository }}/conformance:${VERSION}
- name: Docker Build
run: |
docker build \
--build-arg VERSION=${{ steps.prepare.outputs.version }} \
-t ${{ steps.prepare.outputs.ref }} \
conformance/
- name: Docker Login
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USER }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Docker Push
run: |
docker push ${{ steps.prepare.outputs.ref }}
- name: Clear
if: always()
run: |
rm -f ${HOME}/.docker/config.json