-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (42 loc) · 1.71 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
49
# Workflow to build and release to gh packages
name: Release
on:
create:
tags: release/(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Set Environment Variables
run: |
echo "IMAGE=ghcr.io/${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV
echo "BUILD_DATE=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV
echo "BUILD_VERSION=${GITHUB_REF/"refs/tags/release/"/}" >> $GITHUB_ENV
echo "BUILD_SHA=$GITHUB_SHA" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to ghcr.io
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
labels: |
org.opencontainers.image.authors=${{ github.repository_owner }}
org.opencontainers.image.created=${{ env.BUILD_DATE }}
org.opencontainers.image.description=Created from commit $GITHUB_SHA and ref $GITHUB_REF
org.opencontainers.image.ref.name=$GITHUB_REF
org.opencontainers.image.revision=$GITHUB_SHA
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.version=$GITHUB_REF
tags: |
${{ env.IMAGE }}:latest
${{ env.IMAGE }}:${{ env.BUILD_VERSION }}
${{ env.IMAGE }}:${{ env.BUILD_SHA }}