From 4c944208a94426a763dee3e9c4dbae1bf7a11130 Mon Sep 17 00:00:00 2001 From: Mike Verbanic Date: Wed, 9 Nov 2022 21:58:27 -0500 Subject: [PATCH] fix: update docs (#588) --- README.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/README.md b/README.md index ba9fdaadd..52e64895b 100644 --- a/README.md +++ b/README.md @@ -153,6 +153,45 @@ job: run: 'gcloud info' ``` +### Multiple Service Accounts + +To use multiple service accounts, a second auth step is required to update the credentials before using `setup-gcloud`: + +```yaml +jobs: + job_id: + # Add "id-token" with the intended permissions. + permissions: + contents: 'read' + id-token: 'write' + + steps: + - id: 'auth service account 1' + uses: 'google-github-actions/auth@v1' + with: + workload_identity_provider: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider' + service_account: 'service-account-1@my-project.iam.gserviceaccount.com' + + - name: 'Set up Cloud SDK' + uses: 'google-github-actions/setup-gcloud@v1' + + - name: 'Use gcloud CLI' + run: 'gcloud auth list --filter=status:ACTIVE --format="value(account)"' + # service-account-1@my-project.iam.gserviceaccount.com + + - id: 'auth service account 2' + uses: 'google-github-actions/auth@v1' + with: + credentials_json: '${{ secrets.GCP_CREDENTIALS }}' + + - name: 'Set up Cloud SDK' + uses: 'google-github-actions/setup-gcloud@v1' + + - name: 'Use gcloud CLI' + run: 'gcloud auth list --filter=status:ACTIVE --format="value(account)"' + # service-account-2@my-project.iam.gserviceaccount.com +``` + ## Versioning