Skip to content

Instantly share code, notes, and snippets.

@ErickGiffoni
Last active November 12, 2024 18:36
Show Gist options
  • Save ErickGiffoni/f0600d6d69fa73dd6a02a88b36aad70c to your computer and use it in GitHub Desktop.
Save ErickGiffoni/f0600d6d69fa73dd6a02a88b36aad70c to your computer and use it in GitHub Desktop.
Steps to authenticate to GCP within a GitHub Action
# [...] 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