chore: support WIF in example workflows

This commit is contained in:
Fedor Isakov 2021-12-22 20:09:25 +03:00 committed by GitHub
parent 58c3a9aff9
commit a9839f1d99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 129 additions and 28 deletions

View file

@ -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