Skip to content
Latchkey

google-github-actions/setup-gcloud

Install and configure the gcloud CLI on the runner.

Official actionCategory: Cloud Auth & DeployLatest v2View on GitHub

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

Inputs

InputDescriptionDefaultRequired
versiongcloud version to install.latestNo
project_idDefault project for gcloud.-No
install_componentsExtra 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 selected means the auth step did not run or failed. Add google-github-actions/auth first.

Security and pinning

  • Pin to a commit SHA and pin version for 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.

References

Running google-github-actions/setup-gcloud? Run it on Latchkey managed runners - self-healing and caching included. Start free → 30-day trial · No credit card