{"id":13485179,"url":"https://github.com/google-github-actions/setup-gcloud","last_synced_at":"2025-05-11T03:48:46.885Z","repository":{"id":37469865,"uuid":"219865964","full_name":"google-github-actions/setup-gcloud","owner":"google-github-actions","description":"A GitHub Action for installing and configuring the gcloud CLI.","archived":false,"fork":false,"pushed_at":"2025-02-01T14:16:30.000Z","size":28441,"stargazers_count":1773,"open_issues_count":1,"forks_count":514,"subscribers_count":67,"default_branch":"main","last_synced_at":"2025-05-11T03:48:31.756Z","etag":null,"topics":["actions","bq","gcloud","gcloud-cli","gcloud-sdk","gcp","github-actions","google-cloud","google-cloud-platform","gsutil"],"latest_commit_sha":null,"homepage":"https://cloud.google.com/sdk/docs","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/google-github-actions.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-05T22:54:11.000Z","updated_at":"2025-05-09T22:55:06.000Z","dependencies_parsed_at":"2023-11-07T16:26:11.332Z","dependency_job_id":"da9309f2-f190-45a0-8b5b-1d065a185abd","html_url":"https://github.com/google-github-actions/setup-gcloud","commit_stats":{"total_commits":464,"total_committers":71,"mean_commits":6.535211267605634,"dds":0.7435344827586207,"last_synced_commit":"6189d56e4096ee891640bb02ac264be376592d6a"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-github-actions%2Fsetup-gcloud","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-github-actions%2Fsetup-gcloud/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-github-actions%2Fsetup-gcloud/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-github-actions%2Fsetup-gcloud/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/google-github-actions","download_url":"https://codeload.github.com/google-github-actions/setup-gcloud/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253514559,"owners_count":21920334,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actions","bq","gcloud","gcloud-cli","gcloud-sdk","gcp","github-actions","google-cloud","google-cloud-platform","gsutil"],"created_at":"2024-07-31T17:01:49.266Z","updated_at":"2025-05-11T03:48:46.867Z","avatar_url":"https://github.com/google-github-actions.png","language":"TypeScript","readme":"# `setup-gcloud` GitHub Action\n\nConfigures the [Google Cloud SDK][sdk] in the GitHub Actions environment. The Google Cloud SDK includes both the [gcloud][gcloud] and\n[gsutil][gsutil] binaries.\n\nOr integrate natively with other Google Cloud GitHub Actions:\n\n* [Authenticate to Google Cloud][auth]\n* [Deploy a Cloud Run service](https://github.com/google-github-actions/deploy-cloudrun)\n* [Deploy an App Engine app](https://github.com/google-github-actions/deploy-appengine)\n* [Deploy a Cloud Function](https://github.com/google-github-actions/deploy-cloud-functions)\n* [Access Secret Manager secrets](https://github.com/google-github-actions/get-secretmanager-secrets)\n* [Upload to Cloud Storage](https://github.com/google-github-actions/upload-cloud-storage)\n* [Configure GKE credentials](https://github.com/google-github-actions/get-gke-credentials)\n\n**This is not an officially supported Google product, and it is not covered by a\nGoogle Cloud support contract. To report bugs or request features in a Google\nCloud product, please contact [Google Cloud\nsupport](https://cloud.google.com/support).**\n\n## Prerequisites\n\n-   This action requires Google Cloud credentials to execute gcloud commands.\n    See [Authorization](#Authorization) for more details.\n\n-   This action runs using Node 20. If you are using self-hosted GitHub Actions\n    runners, you must use a [runner\n    version](https://github.com/actions/virtual-environments) that supports this\n    version or newer.\n\n## Usage\n\n```yaml\njobs:\n  job_id:\n    # Add \"id-token\" with the intended permissions.\n    permissions:\n      contents: 'read'\n      id-token: 'write'\n\n    steps:\n    - id: 'auth'\n      uses: 'google-github-actions/auth@v2'\n      with:\n        workload_identity_provider: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider'\n        service_account: 'my-service-account@my-project.iam.gserviceaccount.com'\n\n    - name: 'Set up Cloud SDK'\n      uses: 'google-github-actions/setup-gcloud@v2'\n      with:\n        version: '\u003e= 363.0.0'\n\n    - name: 'Use gcloud CLI'\n      run: 'gcloud info'\n```\n\n## Inputs\n\n\u003c!-- BEGIN_AUTOGEN_INPUTS --\u003e\n\n-   \u003ca name=\"version\"\u003e\u003c/a\u003e\u003ca href=\"#user-content-version\"\u003e\u003ccode\u003eversion\u003c/code\u003e\u003c/a\u003e: _(Optional, default: `latest`)_ A string representing the version or version constraint of the Cloud SDK\n    (`gcloud`) to install (e.g. `\"290.0.1\"` or `\"\u003e= 197.0.1\"`). The default\n    value is `\"latest\"`, which will always download and install the latest\n    available Cloud SDK version.\n\n        - uses: 'google-github-actions/setup-gcloud@v2'\n          with:\n            version: '\u003e= 416.0.0'\n\n    If there is no installed `gcloud` version that matches the given\n    constraint, this GitHub Action will download and install the latest\n    available version that still matches the constraint.\n\n    Authenticating via Workload Identity Federation requires version\n    [363.0.0](https://cloud.google.com/sdk/docs/release-notes#36300_2021-11-02)\n    or newer. If you need support for Workload Identity Federation, specify\n    your version constraint as such:\n\n        - uses: 'google-github-actions/setup-gcloud@v2'\n          with:\n            version: '\u003e= 363.0.0'\n\n    You are responsible for ensuring the `gcloud` version matches the features\n    and components required.\n\n-   \u003ca name=\"project_id\"\u003e\u003c/a\u003e\u003ca href=\"#user-content-project_id\"\u003e\u003ccode\u003eproject_id\u003c/code\u003e\u003c/a\u003e: _(Optional)_ ID of the Google Cloud project. If provided, this will configure gcloud to\n    use this project ID by default for commands. Individual commands can still\n    override the project using the `--project` flag which takes precedence. If\n    unspecified, the action attempts to find the \"best\" project ID by looking\n    at other inputs and environment variables.\n\n-   \u003ca name=\"install_components\"\u003e\u003c/a\u003e\u003ca href=\"#user-content-install_components\"\u003e\u003ccode\u003einstall_components\u003c/code\u003e\u003c/a\u003e: _(Optional)_ List of additional [gcloud\n    components](https://cloud.google.com/sdk/docs/components) to install,\n    specified as a comma-separated list of strings:\n\n        install_components: 'alpha,cloud-datastore-emulator'\n\n-   \u003ca name=\"skip_install\"\u003e\u003c/a\u003e\u003ca href=\"#user-content-skip_install\"\u003e\u003ccode\u003eskip_install\u003c/code\u003e\u003c/a\u003e: _(Optional)_ Skip installation of gcloud and use the [system-supplied\n    version](https://github.com/actions/runner-images) instead. If specified,\n    the `version` input is ignored.\n\n    ⚠️ You will not be able to install additional gcloud components, because the\n    system installation is locked.\n\n\n\u003c!-- END_AUTOGEN_INPUTS --\u003e\n\n## Outputs\n\n\u003c!-- BEGIN_AUTOGEN_OUTPUTS --\u003e\n\n-   `version`: Version of gcloud that was installed.\n\n\n\u003c!-- END_AUTOGEN_OUTPUTS --\u003e\n\n\n## Authorization\n\nThe `setup-gcloud` action installs the Cloud SDK (`gcloud`). To configure its authentication\nto Google Cloud, you must first use the [google-github-actions/auth][auth] action. The `auth`\naction sets [Application Default Credentials][adc], then the `setup-gcloud` action references\nthese credentials to configure [gcloud credentials][gcloud-credentials] . You can\nauthenticate via the following options:\n\n### Workload Identity Federation (preferred)\n\n**⚠️ You must use the Cloud SDK version 390.0.0 or later to authenticate the\n`bq` and `gsutil` tools.**\n\n```yaml\njobs:\n  job_id:\n    # Add \"id-token\" with the intended permissions.\n    permissions:\n      contents: 'read'\n      id-token: 'write'\n\n    steps:\n    - id: 'auth'\n      uses: 'google-github-actions/auth@v2'\n      with:\n        workload_identity_provider: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider'\n        service_account: 'my-service-account@my-project.iam.gserviceaccount.com'\n\n    - name: 'Set up Cloud SDK'\n      uses: 'google-github-actions/setup-gcloud@v2'\n\n    - name: 'Use gcloud CLI'\n      run: 'gcloud info'\n```\n\n### Service Account Key JSON\n\n```yaml\njobs:\n  job_id:\n    steps:\n    - id: 'auth'\n      uses: 'google-github-actions/auth@v2'\n      with:\n        credentials_json: '${{ secrets.GCP_CREDENTIALS }}'\n\n    - name: 'Set up Cloud SDK'\n      uses: 'google-github-actions/setup-gcloud@v2'\n\n    - name: 'Use gcloud CLI'\n      run: 'gcloud info'\n```\n\n### Self-hosted runners on Google Cloud Platform\n\nIf you are using self-hosted runners that are hosted on Google Cloud Platform, credentials\nare automatically obtained from the service account attached to the runner.\nIn this scenario, you do not need to run the [google-github-actions/auth][auth] action.\n\n```yaml\njobs:\n  job_id:\n    steps:\n    - name: 'Set up Cloud SDK'\n      uses: 'google-github-actions/setup-gcloud@v2'\n\n    - name: 'Use gcloud CLI'\n      run: 'gcloud info'\n```\n\n### Multiple Service Accounts\n\nTo use multiple service accounts, a second auth step is required to update the credentials before using `setup-gcloud`:\n\n```yaml\njobs:\n  job_id:\n    # Add \"id-token\" with the intended permissions.\n    permissions:\n      contents: 'read'\n      id-token: 'write'\n\n    steps:\n      - id: 'auth service account 1'\n        uses: 'google-github-actions/auth@v2'\n        with:\n          workload_identity_provider: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider'\n          service_account: 'service-account-1@my-project.iam.gserviceaccount.com'\n\n      - name: 'Set up Cloud SDK'\n        uses: 'google-github-actions/setup-gcloud@v2'\n\n      - name: 'Use gcloud CLI'\n        run: 'gcloud auth list --filter=status:ACTIVE --format=\"value(account)\"'\n        # service-account-1@my-project.iam.gserviceaccount.com\n\n      - id: 'auth service account 2'\n        uses: 'google-github-actions/auth@v2'\n        with:\n          credentials_json: '${{ secrets.GCP_CREDENTIALS }}'\n\n      - name: 'Set up Cloud SDK'\n        uses: 'google-github-actions/setup-gcloud@v2'\n\n      - name: 'Use gcloud CLI'\n        run: 'gcloud auth list --filter=status:ACTIVE --format=\"value(account)\"'\n        # service-account-2@my-project.iam.gserviceaccount.com\n```\n\n\n## Versioning\n\nWe recommend pinning to the latest available major version:\n\n```yaml\n- uses: 'google-github-actions/setup-gcloud@v2'\n```\n\nWhile this action attempts to follow semantic versioning, but we're ultimately\nhuman and sometimes make mistakes. To prevent accidental breaking changes, you\ncan also pin to a specific version:\n\n```yaml\n- uses: 'google-github-actions/setup-gcloud@v2.0.0'\n```\n\nHowever, you will not get automatic security updates or new features without\nexplicitly updating your version number. Note that we only publish `MAJOR` and\n`MAJOR.MINOR.PATCH` versions. There is **not** a floating alias for\n`MAJOR.MINOR`.\n\n\n[github-action]:https://help.github.com/en/categories/automating-your-workflow-with-github-actions\n[auth]: https://github.com/google-github-actions/auth\n[adc]: https://cloud.google.com/docs/authentication/application-default-credentials\n[sdk]: https://cloud.google.com/sdk/\n[gcloud]: https://cloud.google.com/sdk/gcloud/\n[gcloud-credentials]: https://cloud.google.com/docs/authentication/gcloud#gcloud-credentials\n[gsutil]: https://cloud.google.com/storage/docs/gsutil\n[sa-iam-docs]: https://cloud.google.com/iam/docs/service-accounts\n[sa]: https://cloud.google.com/iam/docs/creating-managing-service-accounts\n[wif]: https://cloud.google.com/iam/docs/workload-identity-federation\n[github-runners]: https://github.com/actions/runner-images\n[gcloud-release-notes]: https://cloud.google.com/sdk/docs/release-notes\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle-github-actions%2Fsetup-gcloud","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoogle-github-actions%2Fsetup-gcloud","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle-github-actions%2Fsetup-gcloud/lists"}