Skip to content

Commit d161b85

Browse files
merge
2 parents d18d495 + 5f3257e commit d161b85

File tree

221 files changed

+22134
-22062
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

221 files changed

+22134
-22062
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/.github/ @NHSDigital/nhs-notify-supplier-api-admins
66
*.code-workspace @NHSDigital/nhs-notify-supplier-api-admins
77
/docs/ @NHSDigital/nhs-notify-supplier-api
8-
/infrastructure/terraform/ @NHSDigital/nhs-notify-platform
8+
/infrastructure/terraform/ @NHSDigital/nhs-notify-platform @NHSDigital/nhs-notify-supplier-api-admins
99

1010
# Codeowners must be final check
1111
/.github/CODEOWNERS @NHSDigital/nhs-notify-code-owners

.github/actions/build-docs/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ runs:
1111
uses: actions/checkout@v4
1212
- uses: actions/setup-node@v4
1313
with:
14-
node-version: 18
14+
node-version: 22
1515
- name: Npm cli install
1616
working-directory: .
1717
run: npm ci

.github/actions/build-libraries/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ runs:
1111
uses: actions/checkout@v4
1212
- uses: actions/setup-node@v4
1313
with:
14-
node-version: 24
14+
node-version: 22
1515

1616
- name: Npm install
1717
working-directory: .

.github/actions/build-proxies/action.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ inputs:
2525
description: "Name of the Component to deploy"
2626
required: true
2727
default: 'api'
28+
nodejs_version:
29+
description: "Node.js version, set by the CI/CD pipeline workflow"
30+
required: true
2831

2932
runs:
3033
using: composite
@@ -34,7 +37,16 @@ runs:
3437
uses: actions/checkout@v4
3538
- uses: actions/setup-node@v4
3639
with:
37-
node-version: 24
40+
node-version: ${{ inputs.nodejs_version }}
41+
42+
- name: "Cache node_modules"
43+
uses: actions/cache@v4
44+
with:
45+
path: |
46+
**/node_modules
47+
key: ${{ runner.os }}-node-${{ inputs.nodejs_version }}-${{ hashFiles('**/package-lock.json') }}
48+
restore-keys: |
49+
${{ runner.os }}-node-${{ inputs.nodejs_version }}-
3850
3951
- name: Npm install
4052
working-directory: .

.github/actions/build-sandbox/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ runs:
1212
uses: actions/checkout@v4
1313
- uses: actions/setup-node@v4
1414
with:
15-
node-version: 24
15+
node-version: 22
1616

1717
- name: Npm install
1818
working-directory: .

.github/actions/build-sdk/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ runs:
1111
uses: actions/checkout@v4
1212
- uses: actions/setup-node@v4
1313
with:
14-
node-version: 18
14+
node-version: 22
1515

1616
- name: Npm install
1717
working-directory: .

.github/actions/build-server/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ runs:
1111
uses: actions/checkout@v4
1212
- uses: actions/setup-node@v4
1313
with:
14-
node-version: 24
14+
node-version: 22
1515

1616
- name: Npm install
1717
working-directory: .

.github/workflows/manual-proxy-environment-deploy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232

3333
- uses: actions/setup-node@v6
3434
with:
35-
node-version: 24
35+
node-version: 22
3636

3737
- name: Npm install
3838
working-directory: .

.github/workflows/pr_closed.yaml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,90 @@ jobs:
6262
--targetAccountGroup "nhs-notify-supplier-api-dev" \
6363
--targetComponent "${{ matrix.component }}" \
6464
--terraformAction "apply"
65+
66+
check-event-schemas-version-change:
67+
name: Check for event schemas package version change
68+
needs: check-merge-or-workflow-dispatch
69+
if: needs.check-merge-or-workflow-dispatch.outputs.deploy == 'true'
70+
outputs:
71+
version_changed: ${{ steps.check-version.outputs.version_changed }}
72+
runs-on: ubuntu-latest
73+
permissions:
74+
contents: read
75+
packages: read
76+
steps:
77+
- name: Checkout code
78+
uses: actions/[email protected]
79+
80+
- name: Setup NodeJS
81+
uses: actions/setup-node@v4
82+
with:
83+
node-version: ${{ inputs.nodejs_version }}
84+
85+
- name: check if local version differs from latest published version
86+
id: check-version
87+
run: |
88+
published_version=$(npm view @nhsdigital/nhs-notify-event-schemas-supplier-api --json 2>/dev/null | jq -r '.["dist-tags"].latest // "null"')
89+
echo "Published version: $published_version"
90+
91+
local_version=$(jq -r '.version' internal/events/package.json)
92+
echo "Local version: $local_version"
93+
94+
if [[ $local_version = $published_version ]]; then
95+
echo "Local version is the same as the latest published version - skipping publish"
96+
echo "version_changed=false" >> $GITHUB_OUTPUT
97+
else
98+
echo "Local version is different to the latest published version - publishing new version"
99+
echo "version_changed=true" >> $GITHUB_OUTPUT
100+
fi
101+
102+
test-contract:
103+
name: "Test contracts (provider)"
104+
needs: check-event-schemas-version-change
105+
if: needs.check-event-schemas-version-change.outputs.version_changed == 'true'
106+
runs-on: ubuntu-latest
107+
permissions:
108+
contents: read
109+
packages: read
110+
steps:
111+
- name: "Checkout code"
112+
uses: actions/[email protected]
113+
- name: Setup NodeJS
114+
uses: actions/setup-node@v4
115+
with:
116+
node-version: ${{ inputs.nodejs_version }}
117+
- name: "Install dependencies"
118+
run: npm ci
119+
- name: "Run provider contract tests"
120+
run: make test-contract
121+
env:
122+
GITHUB_PACKAGES_TOKEN: ${{ secrets.GITHUB_TOKEN }}
123+
124+
publish-event-schemas:
125+
name: Publish event schemas package to GitHub package registry
126+
needs:
127+
- check-event-schemas-version-change
128+
- test-contract
129+
if: needs.check-event-schemas-version-change.outputs.version_changed == 'true'
130+
runs-on: ubuntu-latest
131+
permissions:
132+
contents: read
133+
packages: write
134+
135+
steps:
136+
- name: Checkout code
137+
uses: actions/[email protected]
138+
139+
- name: Setup NodeJS
140+
uses: actions/setup-node@v4
141+
with:
142+
node-version: ${{ inputs.nodejs_version }}
143+
registry-url: 'https://npm.pkg.github.com'
144+
145+
- name: Install dependencies
146+
run: npm ci
147+
148+
- name: Publish to GitHub Packages
149+
run: npm publish --workspace internal/events
150+
env:
151+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/stage-1-commit.yaml

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ jobs:
228228
echo "changed=true" >> $GITHUB_OUTPUT
229229
fi
230230
231-
if content=$(git show origin/main:internal/events/schemas/package.json 2>/dev/null); then
231+
if content=$(git show origin/main:internal/events/package.json 2>/dev/null); then
232232
version=$(jq -r .version <<< $content);
233233
else
234234
version=null;
@@ -237,34 +237,33 @@ jobs:
237237
echo "Detected package version $version in main branch"
238238
echo "main_version=$version" >> $GITHUB_OUTPUT
239239
240-
check-schemas-generated:
241-
name: Check event schemas have been regenerated
242-
needs: detect-event-schema-package-changes
243-
if: needs.detect-event-schema-package-changes.outputs.changed == 'true'
244-
runs-on: ubuntu-latest
245-
permissions:
246-
contents: read
247-
steps:
248-
- name: "Checkout code"
249-
uses: actions/checkout@v4
250-
251-
# Simplified caching - template management has more complex caching of installed modules from another build step
252-
- name: "Cache node_modules"
253-
uses: actions/cache@v4
254-
with:
255-
path: |
256-
**/node_modules
257-
key: ${{ runner.os }}-node-${{ inputs.nodejs_version }}-${{ hashFiles('**/package-lock.json') }}
258-
restore-keys: |
259-
${{ runner.os }}-node-${{ inputs.nodejs_version }}-
260-
261-
- name: "Re-generate schemas"
262-
run: |
263-
npm ci --workspace internal/events
264-
npm --workspace internal/events run gen:jsonschema
265-
266-
- name: Check for schema changes
267-
run: git diff --quiet internal/events/schemas
240+
# check-schemas-generated:
241+
# name: Check event schemas have been regenerated
242+
# needs: detect-event-schema-package-changes
243+
# if: needs.detect-event-schema-package-changes.outputs.changed == 'true'
244+
# runs-on: ubuntu-latest
245+
# permissions:
246+
# contents: read
247+
# steps:
248+
# - name: "Checkout code"
249+
# uses: actions/checkout@v4
250+
#
251+
# - name: "Cache node_modules"
252+
# uses: actions/cache@v4
253+
# with:
254+
# path: |
255+
# **/node_modules
256+
# key: ${{ runner.os }}-node-${{ inputs.nodejs_version }}-${{ hashFiles('**/package-lock.json') }}
257+
# restore-keys: |
258+
# ${{ runner.os }}-node-${{ inputs.nodejs_version }}-
259+
#
260+
# - name: "Re-generate schemas"
261+
# run: |
262+
# npm ci
263+
# npm --workspace internal/events run gen:jsonschema
264+
#
265+
# - name: Check for schema changes
266+
# run: git diff --quiet internal/events/schemas
268267

269268
check-schema-version-change:
270269
name: Check event schema version has been updated

0 commit comments

Comments
 (0)