This action configures the Google Cloud SDK in the environment for use in actions. The Google Cloud SDK includes both the gcloud and gsutil binaries.
It does the following:
-
Downloads a version of the Google Cloud SDK according to the specified
versioninput, as well as the environment OS and architecture. -
Installs and caches the downloaded version into the actions environment.
-
If
project_idis specified, gcloud will use this project ID as the default project ID for all future invocations. You can override this on a per-invocation basis using the--projectflag. -
If
service_account_keyis specified, authenticates the gcloud CLI tool using the service account key. For legacy .p12 keys, you must also specify aservice_account_email. -
If
export_default_credentialsis specified, exports the path to the credentials in the environment variableGOOGLE_APPLICATION_CREDENTIALSto be available in later steps. Google Cloud technologies automatically use this environment variable to find credentials.IMPORTANT! Exporting default credentials requires
actions/checkout@v2. Thev1tag is not supported and will not work.
-
This action requires Python 2.7.9 or later to be installed on the environment.
-
A pre-configured GCP service account. More info.
-
actions/checkout@v2if usingexport_default_credentials.
steps:
- uses: actions/checkout@v2
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with:
version: '290.0.1'
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true
- run: gcloud info-
version: (Optional) The version of the gcloud to be installed. Example:290.0.1, Default:latest -
service_account_email: (Optional) Service account email address to use for authentication. This is required for legacy .p12 keys but can be omitted for .json keys. This is usually of the format<name>@<project-id>.iam.gserviceaccount.com. -
service_account_key: (Optional) The service account key which will be used for authentication. This key should be created, encoded as a Base64 string (eg.cat my-key.json | base64on macOS), and stored as a secret. -
export_default_credentials: (Optional) Export the provided credentials as Google Default Application Credentials. This will make the credentials available to later steps. Future steps that consume Default Application Credentials will automatically detect and use these credentials. Every time the action is run, this will generate a temporary file in the root of the repository with a random name, to hold the exported credentials. -
project_id: (Optional) ID of the Google Cloud project. If provided, this will configure gcloud to use this project ID by default for commands. Individual commands can still override the project using the --project flag which takes precedence.