Skip to content

Use artifact registry #3

Use artifact registry

Use artifact registry #3

Workflow file for this run

name: Deploy
on:
push:
branches:
- main
jobs:
build-and-push-image:
name: Build and push image to Google Cloud
permissions:
id-token: write
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Authenticate with Google Cloud
id: auth
uses: google-github-actions/auth@v1
with:
token_format: "access_token"
workload_identity_provider: ${{ secrets.GCS_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCS_SERVICE_ACCOUNT_EMAIL }}
access_token_lifetime: 300s
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v1
with:
registry: "${{ secrets.GCS_REGION }}-docker.pkg.dev"
username: "oauth2accesstoken"
password: ${{ steps.auth.outputs.access_token }}
- name: Build and push
uses: docker/build-push-action@v4
with:
push: true
tags: "${{ secrets.GCS_REGION }}-docker.pkg.dev/${{ secrets.GCS_PROJECT_ID }}/${{ secrets.GCS_ARTIFACT_REPO_NAME }}/compass:${{ github.sha }}"
cache-from: type=gha
cache-to: type=gha,mode=max