feat: migrations workflow #1
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: Deploy worker | |
on: | |
push: | |
paths: | |
- .github/workflows/deploy-worker.yaml | |
- src/functions/** | |
- src/schemas/** | |
- src/services/** | |
- src/utils/** | |
- src/env.d.ts | |
- terraform/** | |
- .nvmrc | |
- .terraformignore | |
- drizzle.config.ts | |
- package.json | |
- tsconfig.json | |
concurrency: worker | |
jobs: | |
node: | |
name: Build artifacts | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: .nvmrc | |
- name: Install dependencies | |
run: npm ci | |
- name: Build Worker | |
run: npm run build:worker | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build | |
path: build | |
terraform: | |
name: Deploy artifacts | |
runs-on: ubuntu-latest | |
needs: [node] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: build | |
path: build | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v1 | |
with: | |
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }} | |
- name: Terraform Init | |
working-directory: terraform | |
run: terraform init | |
- name: Terraform Validate | |
working-directory: terraform | |
run: terraform validate -no-color | |
- name: Terraform Apply | |
working-directory: terraform | |
run: terraform apply -auto-approve |