Skip to content

Commit c529f6a

Browse files
authored
Merge pull request #2118 from ChildMindInstitute/release/2025.08.1
Release 2025.08.1
2 parents 4a97fbc + 1d0b5fa commit c529f6a

19 files changed

Lines changed: 472 additions & 117 deletions

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.github
12
/.git
23
/.vscode
34
/node_modules
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
name: Build and Deploy
2+
on:
3+
workflow_call:
4+
inputs:
5+
env-name:
6+
required: true
7+
description: Environment name
8+
type: string
9+
version:
10+
required: false
11+
description: Version
12+
type: string
13+
default: latest
14+
secrets:
15+
slack-webhook:
16+
required: true
17+
18+
concurrency:
19+
cancel-in-progress: false
20+
group: build-deploy-${{ inputs.env-name }}
21+
22+
env:
23+
# NODE_VERSION: 22.15.0
24+
VITE_BUILD_VERSION: ${{ inputs.version }}
25+
VITE_DD_VERSION: ${{ inputs.version }}
26+
27+
jobs:
28+
setup-vars:
29+
uses: ./.github/workflows/_setup.yaml
30+
with:
31+
env-name: ${{ inputs.env-name }}
32+
33+
build-deploy:
34+
runs-on: ubuntu-latest
35+
name: Node Build and Deploy
36+
needs: setup-vars
37+
permissions:
38+
contents: read
39+
id-token: write
40+
steps:
41+
- uses: actions/checkout@v4
42+
name: Checkout
43+
44+
- name: Setup node version
45+
run: |
46+
echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_ENV
47+
48+
- name: Configure aws credentials for secrets
49+
uses: aws-actions/configure-aws-credentials@v4
50+
with:
51+
role-to-assume: arn:aws:iam::917902836630:role/cmiml-devops-oidc-github-role
52+
role-session-name: OIDC-GHA-Build-Secrets
53+
aws-region: us-east-1
54+
55+
- name: Load build config
56+
uses: aws-actions/aws-secretsmanager-get-secrets@v2
57+
with:
58+
secret-ids: |
59+
,/CodeBuild/admin-panel/${{ inputs.env-name }}
60+
parse-json-secrets: true
61+
62+
- uses: actions/setup-node@v4
63+
name: Setup Node
64+
with:
65+
node-version: ${{ env.NODE_VERSION }}
66+
67+
- name: Install dependencies
68+
run: npm ci
69+
70+
- uses: wearerequired/lint-action@v2
71+
name: Lint
72+
with:
73+
eslint: true
74+
eslint_extensions: js,jsx,ts,tsx
75+
prettier: true
76+
prettier_extensions: js,jsx,ts,tsx
77+
continue_on_error: false
78+
79+
- name: Tests
80+
run: npm run test:nowatch
81+
env:
82+
REACT_APP_API_DOMAIN: http://localhost:8000
83+
REACT_APP_ENV: 'dev'
84+
REACT_APP_WEB_URI: http://localhost:5173
85+
86+
- name: Build admin app
87+
run: npm run build
88+
env:
89+
CI: false
90+
91+
- name: Configure AWS credentials for deploy
92+
uses: aws-actions/configure-aws-credentials@v4
93+
with:
94+
role-to-assume: ${{ needs.setup-vars.outputs.role }}
95+
role-session-name: OIDC-GHA-session-deploy
96+
aws-region: ${{ needs.setup-vars.outputs.region }}
97+
98+
- name: Deploy
99+
run: |
100+
aws s3 sync ./build s3://cmiml-${{ inputs.env-name }}-admin-panel
101+
102+
- name: Invalidate Cloudfront caches
103+
run: |
104+
for id in $(aws cloudfront list-distributions --output json | jq -r '.DistributionList.Items[] | select(.Comment | test("web"; "i")) | .Id'); do
105+
AWS_PAGER="" aws cloudfront create-invalidation --distribution-id ${id} --paths "/*" --output table
106+
done
107+
108+
109+
on-deploy-failure:
110+
runs-on: ubuntu-latest
111+
if: ${{ !cancelled() && (needs.build-deploy.result == 'failure' || needs.build-deploy.result == 'timed_out') }}
112+
needs:
113+
- build-deploy
114+
steps:
115+
- uses: actions/checkout@v4
116+
- name: "Send Slack message on failure"
117+
uses: rtCamp/action-slack-notify@v2
118+
env:
119+
SLACK_COLOR: failure
120+
SLACK_WEBHOOK: ${{ secrets.slack-webhook }}
121+
SLACKIFY_MARKDOWN: true
122+
MSG_MINIMAL: actions url
123+
SLACK_TITLE: Admin Deploy Failed to ${{ inputs.env-name }}
124+
SLACK_MESSAGE: '🚨 Error when executing deployment!'
125+
126+
on-deploy-success:
127+
runs-on: ubuntu-latest
128+
if: ${{ !cancelled() && (needs.build-deploy.result == 'success') }}
129+
needs:
130+
- build-deploy
131+
steps:
132+
- uses: actions/checkout@v4
133+
- name: "Send Slack message on success"
134+
uses: rtCamp/action-slack-notify@v2
135+
env:
136+
SLACK_COLOR: success
137+
SLACK_WEBHOOK: ${{ secrets.slack-webhook }}
138+
SLACKIFY_MARKDOWN: true
139+
MSG_MINIMAL: actions url
140+
SLACK_TITLE: Admin Deployed to ${{ inputs.env-name }}
141+
SLACK_MESSAGE: '🚀 Deployment was successful. Version: *${{ inputs.version }}*'

.github/workflows/_setup.yaml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Setup common variables
2+
on:
3+
workflow_call:
4+
outputs:
5+
role:
6+
description: Role name
7+
value: ${{ jobs.setup-vars.outputs.role }}
8+
region:
9+
description: AWS Region name
10+
value: ${{ jobs.setup-vars.outputs.region }}
11+
cluster:
12+
description: ECS Cluster name
13+
value: ${{ jobs.setup-vars.outputs.cluster }}
14+
inputs:
15+
env-name:
16+
required: true
17+
type: string
18+
description: Environment name
19+
20+
21+
jobs:
22+
setup-vars:
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- name: Map env to AWS Role
27+
id: role
28+
run: |
29+
ENV_NAME="${{ inputs.env-name }}"
30+
case "$ENV_NAME" in
31+
"dev")
32+
echo 'role=arn:aws:iam::017925157769:role/cmiml-dev-oidc-github-role' >> "$GITHUB_OUTPUT"
33+
;;
34+
"test")
35+
echo 'role=arn:aws:iam::641513112151:role/cmiml-test-oidc-github-role' >> "$GITHUB_OUTPUT"
36+
;;
37+
"uat")
38+
echo 'role=arn:aws:iam::641513112151:role/cmiml-uat-oidc-github-role' >> "$GITHUB_OUTPUT"
39+
;;
40+
"stage")
41+
echo 'role=arn:aws:iam::641513112151:role/cmiml-stage-oidc-github-role' >> "$GITHUB_OUTPUT"
42+
;;
43+
"prod")
44+
echo 'role=arn:aws:iam::410431445687:role/cmiml-prod-oidc-github-role' >> "$GITHUB_OUTPUT"
45+
;;
46+
"prod-dr-us-west-2")
47+
echo 'role=arn:aws:iam::973422231492:role/cmiml-dr-oidc-github-role' >> "$GITHUB_OUTPUT"
48+
;;
49+
*)
50+
echo "Bad environment name"
51+
exit 1;
52+
esac
53+
54+
- name: Map env to AWS Region
55+
id: region
56+
run: |
57+
ENV_NAME="${{ inputs.env-name }}"
58+
case "$ENV_NAME" in
59+
"prod-dr-us-west-2")
60+
echo "region=us-west-2" >> "$GITHUB_OUTPUT"
61+
;;
62+
*)
63+
echo "region=us-east-1" >> "$GITHUB_OUTPUT"
64+
;;
65+
esac
66+
- name: Map env to ECS cluster
67+
id: cluster
68+
run: |
69+
ENV_NAME="${{ inputs.env-name }}"
70+
case "$ENV_NAME" in
71+
"prod-dr-us-west-2")
72+
echo "cluster=prod-dr-us-west-2" >> "$GITHUB_OUTPUT"
73+
;;
74+
*)
75+
echo "cluster=cmiml-${ENV_NAME}" >> "$GITHUB_OUTPUT"
76+
;;
77+
esac
78+
79+
outputs:
80+
role: ${{ steps.role.outputs.role }}
81+
region: ${{ steps.region.outputs.region }}
82+
cluster: ${{ steps.cluster.outputs.cluster }}

.github/workflows/ci.yml

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,33 @@
11
name: CI
22
on: [pull_request]
33

4-
env:
5-
NODE_VERSION: 22.15.0
4+
#env:
5+
# NODE_VERSION: 22.15.0
66

77
jobs:
88
lint:
99
name: Lint
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v4
13+
- name: Setup node version
14+
run: |
15+
echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_ENV
1316
1417
- uses: actions/setup-node@v4
1518
with:
1619
node-version: ${{ env.NODE_VERSION }}
20+
cache: 'npm'
1721

1822
- uses: actions/cache@v4
23+
id: cache
1924
with:
2025
path: |
2126
~/node_modules
2227
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
2328

2429
- run: npm ci
30+
if: steps.cache.outputs.cache-hit != 'true'
2531

2632
- uses: wearerequired/lint-action@v2
2733
with:
@@ -30,47 +36,48 @@ jobs:
3036
prettier: true
3137
prettier_extensions: js,jsx,ts,tsx
3238
continue_on_error: false
39+
3340
tests:
41+
needs: lint
42+
name: Tests
3443
runs-on: ubuntu-latest
3544
steps:
3645
- uses: actions/checkout@v4
46+
- name: Setup node version
47+
run: |
48+
echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_ENV
3749
3850
- uses: actions/setup-node@v4
3951
with:
4052
node-version: ${{ env.NODE_VERSION }}
53+
cache: 'npm'
4154

4255
- name: Install deps
4356
run: npm ci
4457

45-
- uses: actions/cache@v4
46-
with:
47-
path: |
48-
~/node_modules
49-
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
50-
5158
- name: Running tests
5259
env:
5360
REACT_APP_API_DOMAIN: http://localhost:8080
5461
REACT_APP_WEB_URI: http://localhost:5173
5562
run: npm run test:nowatch
5663
build:
64+
needs: tests
65+
name: Build
5766
runs-on: ubuntu-latest
5867
steps:
5968
- uses: actions/checkout@v4
69+
- name: Setup node version
70+
run: |
71+
echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_ENV
6072
6173
- uses: actions/setup-node@v4
6274
with:
6375
node-version: ${{ env.NODE_VERSION }}
76+
cache: 'npm'
6477

6578
- name: Install deps
6679
run: npm ci
6780

68-
- uses: actions/cache@v4
69-
with:
70-
path: |
71-
~/node_modules
72-
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
73-
7481
- name: Build admin app
7582
env:
7683
CI: false
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Build and Deploy Dev
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
8+
jobs:
9+
build-deploy:
10+
name: Build and Deploy
11+
uses: ./.github/workflows/_build-deploy.yaml
12+
with:
13+
env-name: dev
14+
secrets:
15+
slack-webhook: ${{ secrets.SLACK_WEBHOOK_DEPLOY_TO_DEV }}

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.github

src/resources/app-en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,9 +468,11 @@
468468
"responsesOnly": "Responses Only",
469469
"responsesAndEhrData": "Responses & EHR Data"
470470
},
471+
"responses": "responses",
471472
"supplementaryFiles": {
472473
"description": "Supplementary files:",
473474
"includes": {
475+
"userJourney": "User Journey Data",
474476
"scheduleHistory": "Include schedule history",
475477
"flowHistory": "Include activity flow history"
476478
}

src/resources/app-fr.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,9 +468,11 @@
468468
"responsesOnly": "Réponses uniquement",
469469
"responsesAndEhrData": "Réponses & données DSE"
470470
},
471+
"responses": "réponses",
471472
"supplementaryFiles": {
472-
"description": "Fichiers supplémentaires :",
473+
"description": "Fichiers supplémentaires:",
473474
"includes": {
475+
"userJourney": "Données du parcours utilisateur",
474476
"scheduleHistory": "Inclure l'historique du programme",
475477
"flowHistory": "Inclure l'historique du flux d'activité"
476478
}

0 commit comments

Comments
 (0)