Skip to content

Commit

Permalink
fix: update docs (#588)
Browse files Browse the repository at this point in the history
  • Loading branch information
verbanicm committed Nov 10, 2022
1 parent 1e0945d commit 4c94420
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions README.md
Expand Up @@ -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

Expand Down

0 comments on commit 4c94420

Please sign in to comment.