This repository was archived by the owner on Apr 30, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
107 lines (105 loc) · 3.29 KB
/
merge.yml
File metadata and controls
107 lines (105 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Merge
concurrency:
group: main
cancel-in-progress: false
# This concurrency group ensures that only one workflow runs at a time for the main branch.
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/action-get-pr@35514fa1d4765547da319e967b509363598e8b46 # v0.1.0
resume-resources:
name: Resume Resources # This job resumes resources for the merged PR which is needed if the resources were paused.
needs: [vars]
uses: ./.github/workflows/resume-resources.yml
with:
app_env: all
secrets: inherit
deploy_stack_dev:
name: Deploy Stack Dev
needs: [resume-resources, vars]
uses: ./.github/workflows/.deploy_stack.yml
with:
environment_name: prod # ::change it to:: dev , template repo only has PROD
command: apply
tag: ${{ needs.vars.outputs.pr }}
app_env: dev
secrets: inherit
retag-images-dev:
name: Retag Images Dev
needs: [deploy_stack_dev, vars]
runs-on: ubuntu-24.04
strategy:
matrix:
package: [backend, migrations, frontend]
steps:
- name: retag
uses: shrink/actions-docker-registry-tag@f04afd0559f66b288586792eb150f45136a927fa # v4
with:
registry: ghcr.io
repository: ${{ github.repository }}/${{ matrix.package }}
target: ${{ needs.vars.outputs.pr }}
tags: |
dev
e2e:
name: E2E Tests
needs: [deploy_stack_dev]
uses: ./.github/workflows/.e2e.yml
with:
frontend_url: https://${{ needs.deploy_stack_dev.outputs.CF_DOMAIN }}
deploy_stack_test:
name: Deploy Stack Test
needs: [vars, e2e]
uses: ./.github/workflows/.deploy_stack.yml
with:
environment_name: prod # ::change it to:: test , template repo only has PROD
command: apply
tag: ${{ needs.vars.outputs.pr }}
app_env: test
secrets: inherit
retag-images-test:
name: Retag Images Test
needs: [deploy_stack_test, vars]
runs-on: ubuntu-24.04
strategy:
matrix:
package: [backend, migrations, frontend]
steps:
- name: retag
uses: shrink/actions-docker-registry-tag@f04afd0559f66b288586792eb150f45136a927fa # v4
with:
registry: ghcr.io
repository: ${{ github.repository }}/${{ matrix.package }}
target: ${{ needs.vars.outputs.pr }}
tags: |
test
pause-resources:
name: Pause Resources # This job pauses resources for the merged PR which is needed if the resources were not paused, this is to save money, remove it after cloning.
needs: [deploy_stack_test]
uses: ./.github/workflows/pause-resources.yml
with:
app_env: all
secrets: inherit