Skip to content

Commit

Permalink
add workflow for continuous deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
epiccoolguy committed Feb 10, 2024
1 parent 41818b6 commit 147231e
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: CD

on:
push:
branches: [master]

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: "read"
id-token: "write"

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Log in to Google Cloud Platform
uses: "google-github-actions/auth@v2"
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: "${{ secrets.GCP_SERVICE_ACCOUNT_EMAIL }}"

- name: Set up Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: "~> 1"

- name: "Initialize Terraform"
run: terraform init -backend-config="bucket=${{ secrets.GCP_TFSTATE_BUCKET_NAME }}"

- name: "Plan Terraform Configuration"
run: terraform plan -out deployment.tfplan

- name: "Apply Terraform Configuration"
run: terraform apply -auto-approve deployment.tfplan

0 comments on commit 147231e

Please sign in to comment.