Skip to content

chore: add rerouting to posthog #23

chore: add rerouting to posthog

chore: add rerouting to posthog #23

Workflow file for this run

name: 'Terraform'
on:
push:
branches: [ "main" ]
pull_request:
permissions:
id-token: write
contents: read
jobs:
terraform:
name: 'Terraform'
runs-on: ubuntu-latest
environment: production
# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest
defaults:
run:
shell: bash
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout
uses: actions/checkout@v3
- name: Configure AWS credentials for github actions
uses: aws-actions/configure-aws-credentials@v2
with:
aws-region: ${{ vars.AWS_DEFAULT_REGION }}
role-to-assume: ${{ vars.ACTIONS_ROLE }}
role-session-name: GitHubActions
audience: sts.amazonaws.com
# Install the latest version of Terraform CLI and configure the Terraform CLI configuration file with a Terraform Cloud user API token
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_wrapper: false
# Setup Nodejs
- name: Use Node v20
uses: actions/setup-node@v1
with:
node-version: 20
# Install & Build repo
- name: Use Bun to install and build
uses: oven-sh/setup-bun@v1
- run: bun install
- run: bun run build
# Initialize a new or existing Terraform working directory by creating initial files, loading any remote state, downloading modules, etc.
- name: Terraform Init
working-directory: ./infra
run: terraform init
# Generates an execution plan for Terraform
- name: Terraform Plan
working-directory: ./infra
run: terraform plan -input=false
# On push to "main", build or change infrastructure according to Terraform configuration files
# Note: It is recommended to set up a required "strict" status check in your repository for "Terraform Cloud". See the documentation on "strict" required status checks for more information: https://help.github.com/en/github/administering-a-repository/types-of-required-status-checks
- name: Terraform Apply
working-directory: ./infra
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: terraform apply -auto-approve -input=false
- name: Cloudfront Invalidation
working-directory: ./infra
run: |
CLOUDFRONT_DISTRIBUTION_ID=$(terraform output -raw cloudfront)
aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*"