-
-
Notifications
You must be signed in to change notification settings - Fork 1
81 lines (68 loc) · 1.96 KB
/
main-branch.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Create and publish a Docker image
on:
push:
branches:
- 'main'
- 'multiarch'
env:
REGISTRY: ghcr.io
IMAGE: ghcr.io/ronoaldo/mercurio
jobs:
multiarch-build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
include:
- dockerfile: Dockerfile
platforms: |-
linux/amd64
linux/arm64
fail-fast: true
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: true
- name: Run tests and export mods
run: make build test
- name: Publish mods for this build
uses: actions/upload-artifact@v3
with:
name: mods.tar.gz
path: /tmp/mods.tar.gz
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3.5.0
with:
images: ${{ env.IMAGE }}
tags: |
type=ref,event=branch
type=ref,event=tag
type=raw,value=r{{date 'YYYYMMDD'}}
- name: Print calculated Docker tags
id: build-tags-check
shell: bash
run: |
echo "${{ steps.meta.outputs.tags }}"
- name: Set up QEMU for multiarch builds
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to the Container registry
uses: docker/login-action@v1.10.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
file: ${{ matrix.dockerfile }}
platforms: ${{ matrix.platforms }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}