2021-02-06 20:52:20 +00:00
|
|
|
name: Build and publish multiarch
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- multiarch
|
2021-02-06 21:48:27 +00:00
|
|
|
- java8-multiarch
|
2021-02-06 20:52:20 +00:00
|
|
|
- multiarch-latest
|
2021-02-06 21:12:34 +00:00
|
|
|
- java15
|
2021-02-06 20:52:20 +00:00
|
|
|
- test/multiarch/*
|
|
|
|
tags:
|
|
|
|
- "[0-9]+.[0-9]+.[0-9]+-multiarch"
|
|
|
|
- "[0-9]+.[0-9]+.[0-9]+-multiarch-latest"
|
2021-02-06 21:12:34 +00:00
|
|
|
- "[0-9]+.[0-9]+.[0-9]+-java15"
|
2021-02-06 20:52:20 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
docker-buildx:
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2.2.0
|
|
|
|
|
|
|
|
- name: Prepare
|
|
|
|
id: prep
|
|
|
|
run: |
|
|
|
|
DOCKER_IMAGE=itzg/minecraft-server
|
|
|
|
VERSION=edge
|
|
|
|
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
|
|
|
VERSION=${GITHUB_REF#refs/tags/}
|
|
|
|
fi
|
|
|
|
if [[ $GITHUB_REF == refs/heads/* ]]; then
|
|
|
|
VERSION=${GITHUB_REF#refs/heads/}
|
|
|
|
if [[ $VERSION == master ]]; then
|
|
|
|
VERSION=latest
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
TAGS="${DOCKER_IMAGE}:${VERSION//\//-}"
|
|
|
|
echo ::set-output name=tags::${TAGS}
|
|
|
|
echo ::set-output name=cache_from::${TAGS}
|
|
|
|
echo ::set-output name=version::${VERSION//\//-}
|
|
|
|
echo ::set-output name=cache_version::${VERSION//\//-}
|
|
|
|
|
|
|
|
- name: Setup Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
|
|
|
|
- name: Cache Docker layers
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: /tmp/.buildx-cache
|
|
|
|
key: ${{ runner.os }}-buildx-${{ steps.prep.outputs.cache_version }}-${{ github.sha }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-buildx-${{ steps.prep.outputs.cache_version }}-
|
|
|
|
|
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
|
|
|
|
- name: Login to DockerHub
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USER }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
|
|
|
|
- name: Build and push
|
|
|
|
id: docker_build
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
file: ./Dockerfile
|
|
|
|
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
|
|
tags: ${{ steps.prep.outputs.tags }}
|
2021-02-09 03:27:25 +00:00
|
|
|
# ensure latest base image is used
|
|
|
|
pull: true
|
2021-02-06 20:52:20 +00:00
|
|
|
cache-from: type=local,src=/tmp/.buildx-cache
|
|
|
|
cache-to: type=local,dest=/tmp/.buildx-cache
|
|
|
|
labels: |
|
|
|
|
org.opencontainers.image.documentation=https://github.com/itzg/docker-minecraft-server
|
|
|
|
org.opencontainers.image.source=https://github.com/itzg/docker-minecraft-server
|
|
|
|
org.opencontainers.image.version=${{ steps.prep.outputs.version }}
|
|
|
|
org.opencontainers.image.revision=${{ github.sha }}
|
|
|
|
|
|
|
|
- name: Image digest
|
|
|
|
run: echo ${{ steps.docker_build.outputs.digest }}
|