-
Notifications
You must be signed in to change notification settings - Fork 6
67 lines (65 loc) · 2.44 KB
/
build.yaml
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: Publish image
on:
# The build will run on all of the following event types. Semver tagged images will be published
# for a release. A long sha image will be published for every push.
release:
types: [published]
push:
branches:
- '**'
jobs:
main:
runs-on: ubuntu-latest
steps:
-
name: Docker meta
id: docker_meta
uses: docker/metadata-action@v3
with:
# Except for Dockerhub, which is the default, tags need to have the registry name in
# them, e.g. ghcr.io for Github container registry, or gcr.io for Google container
# registry.
# Note that the generated tags will look like:
# ghcr.io/{owner}/{repo}:version
images: ghcr.io/${{ github.repository }}
# For a release v1.2.3, we'll produce the following image tags
# v1.2.3
# 1.2.3
# 1.2
# latest
# For non-releases, we'll produce a long sha
flavor: |
latest=${{ github.event_name == 'release' }}
tags: |
type=match,pattern=v\d+\.\d+\.\d+,enable=${{ github.event_name == 'release' }}
type=match,pattern=v(\d+\.\d+\.\d+),enable=${{ github.event_name == 'release' }},group=1
type=match,pattern=v(\d+\.\d+)\.\d+,enable=${{ github.event_name == 'release' }},group=1
type=match,pattern=v(\d+)\.\d+\.\d+,group=1,enable=${{ !startsWith(github.ref, 'refs/tags/v0.') && github.event_name == 'release' }}
type=sha,event=push,value={{sha}},format=long,enable=${{ github.event_name != 'release' }}
labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }}/tree/${{ github.sha }}
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to GitHub Container Registry
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push
id: docker_build
uses: docker/[email protected]
with:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}