forked from hellofresh/eks-rolling-update
-
Notifications
You must be signed in to change notification settings - Fork 4
63 lines (59 loc) · 1.81 KB
/
docker-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
name: docker-build
on:
push:
tags:
- "[0-9]+\\.[0-9]+\\.[0-9]+"
branches:
- master
pull_request:
branches:
- master
release:
types:
- published
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
docker-build:
name: Build and push container images
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v2
- name: Export git tag
uses: tenhaus/get-release-or-tag@v2
id: tag
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
# default branch event
type=edge,branch=${{ github.event.repository.default_branch }},priority=700
type=sha,format=long,branch=${{ github.event.repository.default_branch }},priority=100
# tag event
type=semver,pattern={{version}},event=tag,priority=900
type=semver,pattern={{major}},event=tag,priority=850
type=semver,pattern={{major}}.{{minor}},event=tag,priority=800
type=sha,format=long,event=tag,priority=100
# pr event
type=ref,event=pr,priority=600
- 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@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image
uses: docker/build-push-action@v2
with:
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}