From 5680d2e9228a900b6c185f971caf66f1eb507a33 Mon Sep 17 00:00:00 2001 From: zijiren233 Date: Sat, 18 Jan 2025 04:59:32 +0800 Subject: [PATCH] fix: need login when build docker --- .github/workflows/release.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 20ed67b..1b3ccd5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -177,6 +177,21 @@ jobs: runs-on: ubuntu-24.04-arm runs-on: ${{ matrix.runs-on || 'ubuntu-24.04' }} steps: + - name: Login to GitHub Container Registry + if: ${{ github.event_name != 'pull_request' }} + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Login to DockerHub + uses: docker/login-action@v3 + if: ${{ github.event_name != 'pull_request' && env.DOCKERHUB_REPO }} + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Checkout uses: actions/checkout@v4 with: @@ -210,10 +225,9 @@ jobs: with: context: . build-args: VERSION=${{ needs.release-web.outputs.tag_name }} - push: false labels: ${{ steps.meta.outputs.labels }} platforms: linux/${{ matrix.arch }} - outputs: type=image,"name=${{ env.DOCKERHUB_REPO }},${{ env.GHCR_REPO }}",name-canonical=true + outputs: type=image,"name=${{ env.DOCKERHUB_REPO }},${{ env.GHCR_REPO }}",push-by-digest=true,name-canonical=true - name: Export digest run: |