Last active
November 12, 2024 18:36
-
-
Save ErickGiffoni/f0600d6d69fa73dd6a02a88b36aad70c to your computer and use it in GitHub Desktop.
Steps to authenticate to GCP within a GitHub Action
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# [...] your github action | |
- name: Set up Google Cloud SDK | |
uses: google-github-actions/setup-gcloud@v1 | |
with: | |
project_id: ${{ secrets.GCP_PROJECT_ID }} | |
export_default_credentials: true | |
- name: Authenticate to GCP | |
env: | |
GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }} | |
run: | | |
echo "$GCP_CREDENTIALS" | base64 --decode > "$HOME"/gcp-key.json | |
gcloud auth activate-service-account --key-file="$HOME"/gcp-key.json | |
# [...] the rest of the action |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment