diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index 530389dd..c34576bb 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -20,7 +20,8 @@ jobs: platform: - linux/amd64 permissions: - contents: read + id-token: write + contents: write packages: write steps: @@ -40,6 +41,22 @@ jobs: - name: Docker Setup Buildx uses: docker/setup-buildx-action@v3 + - name: "Authenticate to Google Cloud" + id: google-auth + uses: "google-github-actions/auth@v1" + with: + token_format: "access_token" + workload_identity_provider: "${{ secrets.GCP_PRD_GITHUB_WIF }}" + service_account: "${{ secrets.GCP_PRD_GITHUB_SA_DOCKER_REGISTRY }}" + create_credentials_file: true + + - name: Login to the registry - production + uses: docker/login-action@v2 + with: + registry: asia-docker.pkg.dev + username: oauth2accesstoken + password: "${{ steps.google-auth.outputs.access_token }}" + - name: Docker Login uses: docker/login-action@v3 with: @@ -59,6 +76,7 @@ jobs: with: images: | zilliqa/otterscan + asia-docker.pkg.dev/prj-p-devops-services-tvwmrf63/zilliqa-public/otterscan tags: | type=ref,enable=false,priority=600,prefix=pr-,suffix=,event=pr type=ref,event=branch