Skip to content

Deploy 2025.01.03-1 to Analytics Infra prod #79

Deploy 2025.01.03-1 to Analytics Infra prod

Deploy 2025.01.03-1 to Analytics Infra prod #79

name: Deploy Analytics Infra
run-name: Deploy ${{ github.ref_name }} to Analytics Infra ${{ (github.event_name == 'release' && 'prod') || 'nonprod' }}
on:
push:
branches:
- main
paths:
- "infra/analytics/**"
release:
types: [published]
workflow_dispatch:
inputs:
environment:
description: "target environment"
required: true
default: "dev"
type: choice
options:
- dev
- staging
- prod
jobs:
build-repository:
name: Build Repository
runs-on: ubuntu-22.04
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.9.7
terraform_wrapper: false
- name: Configure AWS credentials
uses: ./.github/actions/configure-aws-credentials
with:
app_name: analytics
environment: shared
- name: Build Repository
run: |
./bin/terraform-init-and-apply.sh infra/analytics/build-repository shared
deploy-infra:
name: Deploy Infrastructure
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
directory: ["database", "service"]
envs: ${{ fromJSON(inputs.environment != null && format('["{0}"]', inputs.environment) || github.event_name == 'release' && '["prod"]' || github.ref_name == 'main' && '["dev", "staging"]' || '["dev"]') }}
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.9.7
terraform_wrapper: false
- name: Configure AWS credentials
uses: ./.github/actions/configure-aws-credentials
with:
app_name: analytics
environment: shared
- name: Terraform Init and Apply
run: |
./bin/terraform-init.sh infra/analytics/${{ matrix.directory }} ${{ matrix.envs }}
export TF_CLI_ARGS="-input=false -auto-approve -var environment_name=${{ matrix.envs }}"
./bin/terraform-apply.sh infra/analytics/${{ matrix.directory }} ${{ matrix.envs }}
send-slack-notification:
if: failure()
needs: [build-repository, deploy-infra]
uses: ./.github/workflows/send-slack-notification.yml
secrets: inherit