Skip to content

Commit

Permalink
Update GCP authentication (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
JalisDiehl authored Jan 12, 2023
1 parent b7c89b5 commit c084657
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions .github/workflows/deploy-published-releases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ env:

jobs:
deploy-library:
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -80,11 +83,13 @@ jobs:
--config-preview-widget-origin=${PREVIEW_WIDGET_ORIGIN} \
--config-preview-widget-url=${PREVIEW_WIDGET_URL}
- name: Authenticate to GCP
- id: 'auth'
name: 'Authenticate to Google Cloud'
if: ${{ !github.event.release.prerelease }}
uses: google-github-actions/auth@v1.0.0
uses: 'google-github-actions/auth@v1'
with:
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
workload_identity_provider: '${{ secrets.GCLOUD_WORKLOAD_IDENTITY }}'
service_account: '${{ secrets.GCLOUD_SERVICE_ACCOUNT }}'

- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1
Expand All @@ -98,6 +103,9 @@ jobs:
gsutil -m setmeta -h "Cache-Control: public, max-age=3600" "gs://${GCLOUD_BUCKET}/js/v1/lib/plug.js"
deploy-preview-widget:
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
runs-on: ubuntu-latest
defaults:
run:
Expand All @@ -124,10 +132,12 @@ jobs:
run: |-
npm run build
- name: Authenticate to GCP
uses: google-github-actions/[email protected]
- id: auth
name: Authenticate to Google Cloud
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
workload_identity_provider: '${{ secrets.GCLOUD_WORKLOAD_IDENTITY }}'
service_account: '${{ secrets.GCLOUD_SERVICE_ACCOUNT }}'

- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1
Expand Down

0 comments on commit c084657

Please sign in to comment.