From 6d5ce8829faf35e422d283d964752a45765910b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=B3=E9=88=9E?= Date: Fri, 22 Dec 2023 02:26:34 +0800 Subject: [PATCH] ci(docker): update GitHub actions and multi-arch build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update the `checkout` action to version 4 - Update the `metadata-action` to version 5 - Add the `setup-qemu` action - Add the `setup-buildx` action - Update the `login-action` to version 3 for DockerHub and GitHub Container Registry - Update the `build-push-action` to version 5 and add `target` and `platforms` options Signed-off-by: 陳鈞 --- .github/workflows/docker_publish.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docker_publish.yml b/.github/workflows/docker_publish.yml index 407b1b6..106c142 100644 --- a/.github/workflows/docker_publish.yml +++ b/.github/workflows/docker_publish.yml @@ -21,13 +21,13 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: submodules: true - name: Docker meta id: meta - uses: docker/metadata-action@v3 + uses: docker/metadata-action@v5 with: images: ryu1845/${{ github.event.repository.name }},ghcr.io/${{ github.repository }} flavor: | @@ -35,12 +35,18 @@ jobs: prefix= suffix= + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + # Create a Access Token and save it as as Actions secret # https://hub.docker.com/settings/security # DOCKERHUB_USERNAME # DOCKERHUB_TOKEN - name: Login to DockerHub - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: username: ryu1845 password: ${{ secrets.DOCKERHUB_TOKEN }} @@ -48,16 +54,18 @@ jobs: # Create a Access Token with `read:packages` and `write:packages` scopes # CR_PAT - name: Login to GitHub Container Registry - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.CR_PAT }} - name: Build and push - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v5 with: context: . push: true + target: final tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + platforms: linux/amd64,linux/arm64