feat(ci-cd): use direct federation #5
This file contains 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
name: Deploy Xplorers API to GCP | |
on: push | |
# push: | |
# branches: [ "main" ] | |
# pull_request: | |
permissions: | |
contents: read | |
id-token: write | |
jobs: | |
deploy-xplorers-api: | |
name: Deploy Xplorers API to GCP | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
env: | |
TERRAFORM_WORKSPACE: prod | |
steps: | |
# Checkout the repository to the GitHub Actions runner | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- id: auth | |
uses: google-github-actions/[email protected] | |
with: | |
workload_identity_provider: ${{ secrets.GOOGLE_CLOUD_WORKLOAD_IDENTITY_PROVIDER }} | |
# service_account: ${{ secrets.GOOGLE_CLOUD_WORKLOAD_IDP_SERVICE_ACCOUNT }} | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v1 | |
- name: Install taskfile | |
run: | | |
sudo snap install task --classic | |
- name: Terraform Apply | |
# if: github.ref == 'refs/heads/"main"' && github.event_name == 'push' | |
run: task terraform-apply |