Skip to content

Commit

Permalink
Update gcp-artifact-registry.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
isaric authored Oct 14, 2023
1 parent 68658b2 commit 630d97d
Showing 1 changed file with 35 additions and 14 deletions.
49 changes: 35 additions & 14 deletions .github/workflows/gcp-artifact-registry.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,45 @@
name: Push to GCR GitHub Action
on: [push]
name: Release
on:
push:

jobs:
build-and-push-to-gcr:
docker-release:
name: Tagged Docker release to Google Artifact Registry
runs-on: ubuntu-latest

permissions:
contents: 'read'
id-token: 'write'
steps:
- uses: actions/checkout@v3
- name: Authenticate to Google Cloud
id: auth

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: [email protected]
- uses: RafikFarhad/push-to-gcr-github-action@v5-beta
access_token_lifetime: 300s

- name: Login to Artifact Registry
uses: docker/login-action@v1
with:
# gcloud_service_key: ${{ secrets.GCLOUD_SERVICE_KEY }} # can be base64 encoded or plain text || not needed if you use google-github-actions/auth
registry: gcr.io
project_id: pv-labs
image_name: weather-app
image_tag: latest
dockerfile: ./Dockerfile
registry: us-west2-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-east-1-docker.pkg.dev/pv-labs/weather-app/weather-app:latest

0 comments on commit 630d97d

Please sign in to comment.