diff --git a/.github/workflows/docker.remotebuild.yml b/.github/workflows/docker.remotebuild.yml index d338c67f..a11e0a1b 100644 --- a/.github/workflows/docker.remotebuild.yml +++ b/.github/workflows/docker.remotebuild.yml @@ -7,7 +7,7 @@ on: workflow_dispatch: env: - REGISTRY: ghcr.io + REGISTRY: ${{ secrets.REGISTRY }} IMAGE_NAME: ${{ github.repository }} jobs: @@ -22,12 +22,20 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 - - name: Log in to the Container registry - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + - id: "auth" + name: "Authenticate to Google Cloud" + uses: "google-github-actions/auth@v1" with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + token_format: "access_token" + workload_identity_provider: ${{ secrets.GAR_WORKLOAD_IDENTITY_PROVIDER }} + service_account: ${{ secrets.GAR_SERVICE_ACCOUNT }} + + - name: Login to GCR + uses: docker/login-action@v1 + with: + registry: gcr.io + username: oauth2accesstoken + password: ${{ steps.auth.outputs.access_token }} - name: Generate docker tags/labels from github build context id: meta @@ -45,10 +53,11 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc with: + secrets: | + "github_token=${{ secrets.GHUB_ACCESS_TOKEN }}" context: . file: ./Dockerfile.remotebuild push: true tags: ${{ steps.meta.outputs.tags }} # org.opencontainers.image.version will match the tag name labels: ${{ steps.meta.outputs.labels }} - \ No newline at end of file