constellation/.github/actions/login_gcp/action.yml

33 lines
1.4 KiB
YAML
Raw Normal View History

name: GCP login
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"
required: true
runs:
2022-09-14 09:14:26 -04:00
using: "composite"
steps:
- 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
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 }}
# Even if preinstalled in Github Actions runner image, this setup does some magic authentication required for gsutil.
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@62d4898025f6041e16b1068643bfc5a696863587 # v1.1.0