Skip to content

SA name in source code #4

SA name in source code

SA name in source code #4

Workflow file for this run

name: Deployment
on:
push:
branches:
- development
- main
env:
PIPELINE_SA_KEY: ${{ secrets.GCP_SA_KEY }}
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
cd src
npm ci
npm run test
deploy_development:
if: github.ref == 'refs/heads/development'
runs-on: ubuntu-latest
needs: [test]
defaults:
run:
working-directory: ./terraform/dev
steps:
- uses: actions/checkout@v4
- name: Google Cloud Auth
uses: 'google-github-actions/auth@v2'
with:
project_id: 'httparchive'
credentials_json: ${{ env.PIPELINE_SA_KEY }}
- uses: hashicorp/setup-terraform@v3
- name: Terraform fmt
id: fmt
run: terraform fmt -check
continue-on-error: true
- name: Terraform Init
id: init
run: terraform init
- name: Terraform Validate
id: validate
run: terraform validate -no-color
- name: Terraform Plan
id: plan
run: |
terraform plan -no-color
continue-on-error: true
- name: Terraform Plan status
if: steps.plan.outcome == 'failure'
run: exit 1
- name: Terraform Apply
id: apply
run: |
terraform apply -auto-approve
deploy_production:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: [test]
defaults:
run:
working-directory: ./terraform/prod
steps:
- uses: actions/checkout@v4
- name: Google Cloud Auth
uses: 'google-github-actions/auth@v2'
with:
project_id: 'httparchive'
credentials_json: ${{ env.PIPELINE_SA_KEY }}
- uses: hashicorp/setup-terraform@v3
- name: Terraform fmt
id: fmt
run: terraform fmt -check
continue-on-error: true
- name: Terraform Init
id: init
run: terraform init
- name: Terraform Validate
id: validate
run: terraform validate -no-color
- name: Terraform Plan
id: plan
run: |
terraform plan -no-color
continue-on-error: true
- name: Terraform Plan status
if: steps.plan.outcome == 'failure'
run: exit 1
- name: Terraform Apply
id: apply
run: |
terraform apply -auto-approve