Skip to content
name: Deploy Xplorers API to GCP
on: push
permissions:
contents: read
id-token: write
jobs:
deploy-xplorers-api:
name: Deploy Xplorers API to GCP
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
- id: auth
uses: google-github-actions/[email protected]
with:
workload_identity_provider: ${{ secrets.GOOGLE_CLOUD_WORKLOAD_IDENTITY_PROVIDER }}
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Check for Terraform changes
id: check_changes
run: |
if [ $(git rev-list --count HEAD) -gt 1 ]; then
if git diff --name-only HEAD~1 | grep -q '^terraform/.*\.tf$'; then
echo "backend_api_changes=true" >> $GITHUB_ENV
else
echo "backend_api_changes=false" >> $GITHUB_ENV
fi
else
echo "backend_api_changes=false" >> $GITHUB_ENV
fi
- name: Install taskfile
run: |
sudo snap install task --classic
- name: Backend API Terraform Plan
run: task backend-plan
if: env.backend_api_changes == 'true'
- name: Backend Terraform Apply
if: github.ref == 'refs/heads/"main"' && github.event_name == 'push' && env.backend_api_changes == 'true'
run: task terraform-apply