lab5-gcp-prd1 #54
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: lab5-gcp-prd1 | |
run-name: lab5-gcp-prd1 | |
env: | |
google_project: lab5-gcp-prd1 | |
workload_identity_provider: projects/1052177418821/locations/global/workloadIdentityPools/github/providers/google-infra | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: true | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
tags: | |
- lab5-gcp-prd1 | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
terraform-plan: | |
runs-on: ubuntu-latest | |
steps: | |
- id: checkout | |
name: Code Checkout | |
uses: actions/checkout@v4 | |
- id: auth | |
name: Google Cloud Authentication | |
uses: google-github-actions/auth@v2 | |
with: | |
project_id: ${{ env.google_project }} | |
workload_identity_provider: ${{ env.workload_identity_provider }} | |
- id: cache | |
name: Terraform Cache | |
uses: actions/cache@v4 | |
with: | |
path: terraform/.terraform | |
key: ${{ runner.os }}-terraform-${{ hashFiles('terraform/.terraform.lock.hcl') }} | |
- id: terraform-plan | |
name: Terraform Plan | |
run: |- | |
google_project=${{ env.google_project }} make settings terraform-plan | |
terraform-apply: | |
runs-on: ubuntu-latest | |
environment: lab5-gcp-prd1 | |
needs: terraform-plan | |
if: ${{ success() && github.ref == 'refs/tags/lab5-gcp-prd1' }} | |
steps: | |
- id: checkout | |
name: Code Checkout | |
uses: actions/checkout@v4 | |
- id: auth | |
name: Google Cloud Authentication | |
uses: google-github-actions/auth@v2 | |
with: | |
project_id: ${{ env.google_project }} | |
workload_identity_provider: ${{ env.workload_identity_provider }} | |
- id: cache | |
name: Terraform Cache | |
uses: actions/cache@v4 | |
with: | |
path: terraform/.terraform | |
key: ${{ runner.os }}-terraform-${{ hashFiles('terraform/.terraform.lock.hcl') }} | |
- id: terraform-apply | |
name: Terraform Apply | |
run: |- | |
google_project=${{ env.google_project }} make settings terraform-apply |