Skip to content

Merge

Merge #39

Workflow file for this run

name: Merge
on:
push:
branches: [main]
workflow_dispatch:
inputs:
pr_no:
description: "PR-numbered container set to deploy"
type: number
required: true
permissions:
id-token: write # This is required for requesting the JWT
contents: write # This is required for actions/checkout
packages: write
env:
AWS_REGION: ca-central-1
jobs:
vars:
name: Set Variables
outputs:
pr: ${{ steps.pr.outputs.pr || github.event.inputs.pr_no }}
runs-on: ubuntu-24.04
timeout-minutes: 1
steps:
# Get PR number for squash merges to main
- name: PR Number
if: ${{ github.event_name != 'workflow_dispatch' }}
id: pr
uses: bcgov-nr/[email protected]
deploy-db:
needs: [vars]
name: Deploys Database
uses: ./.github/workflows/.deployer.yml
with:
environment_name: dev
command: apply
working_directory: database
app_env: dev
secrets: inherit
deploy-api:
name: Deploys API
needs: [vars,deploy-db]
uses: ./.github/workflows/.deployer.yml
with:
environment_name: dev
command: apply
working_directory: api
tag: ${{ needs.vars.outputs.pr }}
app_env: dev
secrets: inherit
deploy-cloudfront:
name: Deploys Cloudfront
needs: [vars]
uses: ./.github/workflows/.deployer.yml
with:
environment_name: dev
command: apply
working_directory: frontend
app_env: dev
secrets: inherit
build-ui:
name: Builds UI
needs: [deploy-api, deploy-cloudfront]
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: setup node
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_DEPLOY_ROLE_ARN }}
aws-region: ${{ env.AWS_REGION }}
- name: Build And Update UI (CF)
working-directory: frontend
env:
VITE_API_BASE_URL: ${{ needs.deploy-api.outputs.API_GW_URL }}/api
S3_BUCKET_ARN: ${{ needs.deploy-cloudfront.outputs.S3_BUCKET_ARN }}
CF_DISTRIBUTION_ID: ${{ needs.deploy-cloudfront.outputs.CF_DISTRIBUTION_ID }}
run: |
npm run deploy
aws s3 sync --delete ./dist s3://$(echo "$S3_BUCKET_ARN" | cut -d: -f6)
aws cloudfront create-invalidation --distribution-id $CF_DISTRIBUTION_ID --paths "/*"
load-test:
needs: [deploy-api, build-ui, deploy-cloudfront]
name: Load Test
uses: ./.github/workflows/.load-test.yml
with:
BACKEND_URL: ${{ needs.deploy-api.outputs.API_GW_URL }}/api
FRONTEND_URL: https://${{ needs.deploy-cloudfront.outputs.CF_DOMAIN }}