Merge pull request #13 from farribeiro/patch-2 #42
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: Multiarch build docker image | |
on: | |
push: | |
branches: | |
- 'main' | |
- 'stable-5' | |
- '**issue**' | |
- '**patch**' | |
- 'ronoaldo/**' | |
pull_request: | |
env: | |
REGISTRY: ghcr.io | |
IMAGE: ghcr.io/ronoaldo/minetestserver | |
jobs: | |
multiarch-build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
matrix: | |
include: | |
- dockerfile: Dockerfile | |
args: |- | |
MINETEST_VERSION=master | |
MINETEST_GAME_VERSION=master | |
MINETEST_IRRLICHT_VERSION=master | |
tags: |- | |
5.8.0-dev | |
unstable | |
dev | |
platforms: |- | |
linux/amd64 | |
linux/arm64 | |
- dockerfile: Dockerfile | |
args: |- | |
MINETEST_VERSION=5.7.0 | |
MINETEST_GAME_VERSION=5.7.0 | |
MINETEST_IRRLICHT_VERSION=1.9.0mt10 | |
tags: |- | |
stable | |
stable-5 | |
platforms: |- | |
linux/amd64 | |
linux/arm64 | |
fail-fast: true | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Extract Minetest branch from Dockerfile/args | |
id: minetest-version | |
run: | | |
export MINETEST_VERSION="$(echo "${{ matrix.args }}" | grep MINETEST_VERSION | cut -f 2 -d=)" | |
echo "::set-output name=version::${MINETEST_VERSION}" | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v3.5.0 | |
with: | |
images: ${{ env.IMAGE }} | |
tags: | | |
${{ steps.minetest-version.outputs.version }} | |
${{ matrix.tags }} | |
- 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: . | |
file: ${{ matrix.dockerfile }} | |
build-args: ${{ matrix.args }} | |
platforms: ${{ matrix.platforms }} | |
push: ${{ github.ref_name == 'main' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |