Release to Production #46
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: Release to Production | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: "0 3 * * 4" # Every Thursday at 3am | |
permissions: | |
id-token: write # This is required for Az CLI Login | |
contents: read # This is required for actions/checkout | |
concurrency: # This is required to prevent multiple runs of the same workflow from running at the same time. | |
group: ${{ github.workflow }} | |
jobs: | |
terraform-plan-and-apply-dev: | |
environment: Development | |
runs-on: ubuntu-latest | |
concurrency: # This is required to prevent multiple GitHub Actions invocations against stateful resources. e.g. Terraform state file / Database / Deployed Apps | |
group: ${{ github.repository }}-dev | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: frasermolyneux/actions/terraform-plan-and-apply@main | |
with: | |
terraform-folder: "terraform" | |
terraform-var-file: "tfvars/dev.tfvars" | |
terraform-backend-file: "backends/dev.backend.hcl" | |
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} | |
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | |
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
terraform-plan-and-apply-prd: | |
environment: Production | |
runs-on: ubuntu-latest | |
needs: [terraform-plan-and-apply-dev] | |
concurrency: # This is required to prevent multiple GitHub Actions invocations against stateful resources. e.g. Terraform state file / Database / Deployed Apps | |
group: ${{ github.repository }}-prd | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: frasermolyneux/actions/terraform-plan-and-apply@main | |
with: | |
terraform-folder: "terraform" | |
terraform-var-file: "tfvars/prd.tfvars" | |
terraform-backend-file: "backends/prd.backend.hcl" | |
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} | |
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | |
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} |