google-github-actions/setup-gcloud
Install and configure the gcloud CLI on the runner.
What it does
google-github-actions/setup-gcloud installs the gcloud CLI so later steps can deploy to Cloud Run, GKE, App Engine, or manage GCP resources.
Run google-github-actions/auth first so gcloud is authenticated.
Usage
workflow (.yml)
steps:
- uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ vars.WIF_PROVIDER }}
service_account: ${{ vars.WIF_SA }}
- uses: google-github-actions/setup-gcloud@v2
- run: gcloud run deploy app --image gcr.io/my-project/app --region us-central1Inputs
| Input | Description | Default | Required |
|---|---|---|---|
version | gcloud version to install. | latest | No |
project_id | Default project for gcloud. | - | No |
install_components | Extra components to install, e.g. gke-gcloud-auth-plugin. | - | No |
Notes
Authenticate with google-github-actions/auth before this step or gcloud commands will fail.
Common errors
You do not currently have an active account selectedmeans the auth step did not run or failed. Add google-github-actions/auth first.
Security and pinning
- Pin to a commit SHA and pin
versionfor reproducible deploys.
Alternatives and related
Frequently asked questions
Do I need setup-gcloud to deploy to Cloud Run?
Yes if you call gcloud directly. Authenticate with the auth action first, then install gcloud with setup-gcloud.