From 34c45ec8835418309ecb586784ff93f985669151 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sat, 31 Oct 2020 14:48:51 -0500 Subject: [PATCH 1/2] Switched to latest Docker buildx github action --- .github/workflows/build-multiarch.yml | 57 ++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-multiarch.yml b/.github/workflows/build-multiarch.yml index bca773dd..e18d7c72 100644 --- a/.github/workflows/build-multiarch.yml +++ b/.github/workflows/build-multiarch.yml @@ -3,8 +3,11 @@ on: push: branches: - multiarch + - multiarch-latest + - "test-multiarch-.*" tags: - "[0-9]+.[0-9]+.[0-9]+-multiarch" + - "[0-9]+.[0-9]+.[0-9]+-multiarch-latest" jobs: docker-buildx: @@ -12,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 }} From b7bcd252d33d64c3177c6452f71f321781ebd347 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Wed, 25 Nov 2020 16:06:01 -0600 Subject: [PATCH 2/2] ci: Fixed tag extraction --- .github/workflows/build-multiarch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-multiarch.yml b/.github/workflows/build-multiarch.yml index e18d7c72..28387d26 100644 --- a/.github/workflows/build-multiarch.yml +++ b/.github/workflows/build-multiarch.yml @@ -22,7 +22,7 @@ jobs: DOCKER_IMAGE=itzg/minecraft-server VERSION=edge if [[ $GITHUB_REF == refs/tags/* ]]; then - VERSION=${GITHUB_REF#refs/tags/v} + VERSION=${GITHUB_REF#refs/tags/} fi if [[ $GITHUB_REF == refs/heads/* ]]; then VERSION=${GITHUB_REF#refs/heads/}