forked from valhalla/valhalla
-
Notifications
You must be signed in to change notification settings - Fork 1
50 lines (50 loc) · 1.81 KB
/
docker-build.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
50
name: Publish Docker image
on:
push:
branches:
- 'master'
tags:
- '*'
paths-ignore:
- '.gitignore'
- '**.md'
- 'test/'
jobs:
build_and_publish:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
with:
submodules: 'recursive'
fetch-depth: 0
- name: Extract tag name
if: startsWith(github.ref, 'refs/tags/')
run: echo "##[set-output name=tag;]${GITHUB_REF#refs/tags/}"
id: extract_tag
- name: Log in to GitHub Docker Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build tag image
if: startsWith(github.ref, 'refs/tags/')
run: |
sudo apt update --yes
sudo apt install --yes --quiet binfmt-support qemu-user-static qemu-system
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx create --name mybuilder
docker buildx use mybuilder
docker buildx inspect --bootstrap
docker buildx build --push --platform linux/amd64,linux/arm64 --tag ghcr.io/valhalla/valhalla:${{ steps.extract_tag.outputs.tag }} .
- name: Build latest image
if: github.ref == 'refs/heads/master'
run: |
sudo apt update --yes
sudo apt install --yes --quiet binfmt-support qemu-user-static qemu-system
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx create --name mybuilder
docker buildx use mybuilder
docker buildx inspect --bootstrap
docker buildx build --push --platform linux/amd64,linux/arm64 --tag ghcr.io/valhalla/valhalla:latest .