Switched to latest Docker buildx github action

This commit is contained in:
Geoff Bourne 2020-10-31 14:48:51 -05:00
parent cb0add3b90
commit 72d7d4a65e

View file

@ -4,6 +4,7 @@ on:
branches:
- multiarch
- multiarch-latest
- "test-multiarch-.*"
tags:
- "[0-9]+.[0-9]+.[0-9]+-multiarch"
- "[0-9]+.[0-9]+.[0-9]+-multiarch-latest"
@ -14,14 +15,48 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2.2.0
- name: Get branch name
uses: nelonoel/branch-name@v1
- name: Docker Buildx
uses: ilteoood/docker_buildx@1.0.4
with:
publish: true
imageName: itzg/minecraft-server
tag: ${{ env.BRANCH_NAME }}
dockerHubUser: ${{ secrets.DOCKER_USER }}
dockerHubPassword: ${{ secrets.DOCKER_PASSWORD }}
- name: Prepare
id: prep
run: |
DOCKER_IMAGE=itzg/minecraft-server
VERSION=edge
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
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}
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v1
- 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 }}
cache-from: type=registry,ref=${{ steps.prep.outputs.cache_from }}
cache-to: type=inline
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}