Merge branch 'master' into internal #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Docker image | |
on: | |
push: | |
branches: | |
- 'master' | |
- 'internal' | |
tags: | |
- '*' | |
paths-ignore: | |
- '.gitignore' | |
- '**.md' | |
- 'test/' | |
jobs: | |
build_and_publish: | |
runs-on: ubuntu-latest | |
if: ${{ github.repository_owner == 'droidsolutions' }} | |
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/droidsolutions/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/droidsolutions/valhalla:latest . |