diff --git a/.github/workflows/gcp-artifact-registry.yml b/.github/workflows/gcp-artifact-registry.yml new file mode 100644 index 0000000..d92258f --- /dev/null +++ b/.github/workflows/gcp-artifact-registry.yml @@ -0,0 +1,45 @@ +name: Release +on: + push: + +jobs: + docker-release: + name: Tagged Docker release to Google Artifact Registry + runs-on: ubuntu-latest + + permissions: + contents: 'read' + id-token: 'write' + + steps: + - id: checkout + name: Checkout + uses: actions/checkout@v2 + + - id: auth + name: Authenticate with Google Cloud + uses: google-github-actions/auth@v0 + with: + token_format: access_token + workload_identity_provider: projects/363816104163/locations/global/workloadIdentityPools/pv-labs-pool/providers/pv-labs-workload-provider + service_account: github-actions@pv-labs.iam.gserviceaccount.com + access_token_lifetime: 300s + + - name: Login to Artifact Registry + uses: docker/login-action@v1 + with: + registry: us-east1-docker.pkg.dev + username: oauth2accesstoken + password: ${{ steps.auth.outputs.access_token }} + + - name: Get tag + id: get-tag + run: echo ::set-output name=short_ref::${GITHUB_REF#refs/*/} + + - id: docker-push-tagged + name: Tag Docker image and push to Google Artifact Registry + uses: docker/build-push-action@v2 + with: + push: true + tags: | + us-east1-docker.pkg.dev/pv-labs/weather-app/weather-app:v1