mirror of
https://github.com/google-github-actions/setup-gcloud.git
synced 2026-09-01 13:29:22 +00:00
chore: support WIF in example workflows
This commit is contained in:
parent
58c3a9aff9
commit
a9839f1d99
7 changed files with 129 additions and 28 deletions
|
|
@ -28,17 +28,32 @@ jobs:
|
|||
name: Setup, Build, and Deploy
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# Add "id-token" with the intended permissions.
|
||||
permissions:
|
||||
contents: 'read'
|
||||
id-token: 'write'
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Setup gcloud CLI
|
||||
- uses: google-github-actions/setup-gcloud@master
|
||||
# Configure Workload Identity Federation and generate an access token.
|
||||
- id: 'auth'
|
||||
name: 'Authenticate to Google Cloud'
|
||||
uses: 'google-github-actions/auth@v0'
|
||||
with:
|
||||
version: '286.0.0'
|
||||
service_account_email: ${{ secrets.RUN_SA_EMAIL }}
|
||||
service_account_key: ${{ secrets.RUN_SA_KEY }}
|
||||
project_id: ${{ secrets.RUN_PROJECT }}
|
||||
workload_identity_provider: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider'
|
||||
service_account: 'my-service-account@my-project.iam.gserviceaccount.com'
|
||||
|
||||
# Alternative option - authentication via credentials json
|
||||
# - id: 'auth'
|
||||
# uses: 'google-github-actions/auth@v0'
|
||||
# with:
|
||||
# credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
|
||||
|
||||
# Setup gcloud CLI
|
||||
- name: Set up Cloud SDK
|
||||
uses: google-github-actions/setup-gcloud@v0
|
||||
|
||||
# Build and push image to Google Container Registry
|
||||
- name: Build
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue