name: 'Usage of auth GitHub Action'
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: 'google-github-actions/auth@v2'
with:
project_id: 'my-project'
workload_identity_provider: >
'projects/12/locations/global/workloadIdentityPools/pool/providers/provider'
Authenticate to Google Cloud
A GitHub Action for authenticating to Google Cloud.
What is Authenticate to Google Cloud GitHub Action?
This GitHub Action authenticate to Google Cloud from GitHub Actions, supporting both Service Account Key JSON and Workload Identity Federation.
Authentication Methods
Service Account Key JSON
Using a Service Account Key JSON file is a straightforward way to authenticate your GitHub Actions with Google Cloud.
- name: Authenticate to Google Cloud
uses: google-github-actions/[email protected]
with:
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
Workload Identity Federation
Workload Identity Federation is a more secure and manageable way to authenticate, especially in multi-cloud environments. Note: This option is not supported by Firebase Admin SDK.
- name: Authenticate to Google Cloud
uses: google-github-actions/[email protected]
with:
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT_EMAIL }} # Optional
audience: projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider # Optional
Monitoring GitHub Actions Workflows
CICube is a GitHub Actions monitoring tool that provides you with detailed insights into your workflows to further optimize your CI/CD pipeline. With CICube, you will be able to track your workflow runs, understand where the bottlenecks are, and tease out the best from your build times. Go to cicube.io now and create a free account to better optimize your GitHub Actions workflows!