2022-07-13 08:04:46 -04:00
|
|
|
name: GCP login
|
2022-05-03 05:15:53 -04:00
|
|
|
description: "Login to GCP & configure gcloud CLI."
|
|
|
|
inputs:
|
2023-01-16 12:15:17 -05:00
|
|
|
service_account:
|
|
|
|
description: "GCP service account name. Format: <account-name>@<project-name>.iam.gserviceaccount.com"
|
2022-05-03 05:15:53 -04:00
|
|
|
required: true
|
|
|
|
runs:
|
2022-09-14 09:14:26 -04:00
|
|
|
using: "composite"
|
2022-05-03 05:15:53 -04:00
|
|
|
steps:
|
2023-04-27 04:55:57 -04:00
|
|
|
- name: Clean env to prevent warnings
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
echo "CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE=" >> "$GITHUB_ENV"
|
|
|
|
echo "GOOGLE_APPLICATION_CREDENTIALS=" >> "$GITHUB_ENV"
|
|
|
|
echo "GOOGLE_GHA_CREDS_PATH=" >> "$GITHUB_ENV"
|
|
|
|
echo "CLOUDSDK_CORE_PROJECT=" >> "$GITHUB_ENV"
|
|
|
|
echo "CLOUDSDK_PROJECT=" >> "$GITHUB_ENV"
|
|
|
|
echo "GCLOUD_PROJECT=" >> "$GITHUB_ENV"
|
|
|
|
echo "GCP_PROJECT=" >> "$GITHUB_ENV"
|
|
|
|
echo "GOOGLE_CLOUD_PROJECT=" >> "$GITHUB_ENV"
|
|
|
|
|
2022-09-14 09:14:26 -04:00
|
|
|
# As described at:
|
|
|
|
# https://github.com/google-github-actions/setup-gcloud#service-account-key-json
|
|
|
|
- name: Authorize GCP access
|
2023-05-05 08:42:20 -04:00
|
|
|
uses: google-github-actions/auth@e8df18b60c5dd38ba618c121b779307266153fbf # v1.1.0
|
2022-09-14 09:14:26 -04:00
|
|
|
with:
|
2023-01-16 12:15:17 -05:00
|
|
|
workload_identity_provider: projects/796962942582/locations/global/workloadIdentityPools/constellation-ci-pool/providers/constellation-ci-provider
|
|
|
|
service_account: ${{ inputs.service_account }}
|
2022-09-26 10:37:43 -04:00
|
|
|
|
|
|
|
# Even if preinstalled in Github Actions runner image, this setup does some magic authentication required for gsutil.
|
|
|
|
- name: Set up Cloud SDK
|
2023-02-15 08:47:42 -05:00
|
|
|
uses: google-github-actions/setup-gcloud@62d4898025f6041e16b1068643bfc5a696863587 # v1.1.0
|