Skip to content

πŸ—„ [chore] cleanup #4

πŸ—„ [chore] cleanup

πŸ—„ [chore] cleanup #4

Workflow file for this run

name: "πŸš€ Apply Staging"
on:
push:
branches:
- "develop"
paths:
- "staging/**"
- "template/**"
- ".github/workflows/apply-staging.yml"
workflow_dispatch:
# Stateless runs must never overlap: each one imports existing buckets into
# a fresh throwaway state, so two racing applies would double-create.
concurrency:
group: terraform-staging
cancel-in-progress: false
permissions:
contents: read
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
TF_VAR_cloudflare_account_id: ${{ secrets.TF_VAR_CLOUDFLARE_ACCOUNT_ID }}
TF_IN_AUTOMATION: "true"
# Lets mise query the GitHub releases API without anonymous rate limits
GITHUB_TOKEN: ${{ github.token }}
jobs:
plan:
name: "πŸ— Terraform Plan"
runs-on: ubuntu-latest
environment: "Staging Plan"
defaults:
run:
working-directory: "staging"
steps:
- name: "πŸ›’ Checkout"
uses: actions/checkout@v7
- name: "🐭 Setup mise"
uses: jdx/mise-action@v4
- name: "🎨 Format Check"
working-directory: "."
run: terraform fmt -check -recursive staging template
- name: "βš™οΈ Terraform Init"
run: terraform init -input=false
- name: "βœ… Terraform Validate"
run: terraform validate
- name: "πŸ“₯ Import Existing Buckets"
working-directory: "."
run: ./scripts/import-resources.sh
- name: "πŸ“‹ Terraform Plan"
run: terraform plan -input=false -out=tfplan
- name: "πŸ“¦ Upload Plan"
uses: actions/upload-artifact@v4
with:
name: tfplan
path: |
staging/tfplan
staging/terraform.tfstate
retention-days: 3
if-no-files-found: warn
apply:
name: "πŸš€ Terraform Apply"
needs: plan
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
environment: "Staging"
defaults:
run:
working-directory: "staging"
steps:
- name: "πŸ›’ Checkout"
uses: actions/checkout@v7
- name: "🐭 Setup mise"
uses: jdx/mise-action@v4
- name: "πŸ“¦ Download Plan"
uses: actions/download-artifact@v4
with:
name: tfplan
path: staging
- name: "βš™οΈ Terraform Init"
run: terraform init -input=false
- name: "πŸš€ Terraform Apply"
run: terraform apply -input=false tfplan