Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/actions/build-docs/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ inputs:
version:
description: "Version number"
required: true
NODE_AUTH_TOKEN:
description: "Token for access to github package registry"
required: true
runs:
using: "composite"
steps:
Expand All @@ -12,8 +15,11 @@ runs:
- uses: actions/setup-node@v4
with:
node-version: 22
registry-url: 'https://npm.pkg.github.com'
- name: Npm cli install
working-directory: .
env:
NODE_AUTH_TOKEN: ${{ inputs.NODE_AUTH_TOKEN }}
run: npm ci
shell: bash
- name: Setup Ruby
Expand Down
6 changes: 6 additions & 0 deletions .github/actions/build-libraries/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ inputs:
version:
description: "Version number"
required: true
NODE_AUTH_TOKEN:
description: "Token for access to github package registry"
required: true
runs:
using: "composite"
steps:
Expand All @@ -12,9 +15,12 @@ runs:
- uses: actions/setup-node@v4
with:
node-version: 22
registry-url: 'https://npm.pkg.github.com'

- name: Npm install
working-directory: .
env:
NODE_AUTH_TOKEN: ${{ inputs.NODE_AUTH_TOKEN }}
run: npm ci
shell: bash

Expand Down
6 changes: 6 additions & 0 deletions .github/actions/build-proxies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ inputs:
nodejs_version:
description: "Node.js version, set by the CI/CD pipeline workflow"
required: true
NODE_AUTH_TOKEN:
description: "Token for access to github package registry"
required: true

runs:
using: composite
Expand All @@ -38,6 +41,7 @@ runs:
- uses: actions/setup-node@v4
with:
node-version: ${{ inputs.nodejs_version }}
registry-url: 'https://npm.pkg.github.com'

- name: "Cache node_modules"
uses: actions/cache@v4
Expand All @@ -50,6 +54,8 @@ runs:

- name: Npm install
working-directory: .
env:
NODE_AUTH_TOKEN: ${{ inputs.NODE_AUTH_TOKEN }}
run: npm ci
shell: bash

Expand Down
7 changes: 7 additions & 0 deletions .github/actions/build-sandbox/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ inputs:
version:
description: "Version number"
required: true

NODE_AUTH_TOKEN:
description: "Token for access to github package registry"
required: true
runs:
using: composite

Expand All @@ -13,9 +17,12 @@ runs:
- uses: actions/setup-node@v4
with:
node-version: 22
registry-url: 'https://npm.pkg.github.com'

- name: Npm install
working-directory: .
env:
NODE_AUTH_TOKEN: ${{ inputs.NODE_AUTH_TOKEN }}
run: npm ci
shell: bash

Expand Down
6 changes: 6 additions & 0 deletions .github/actions/build-sdk/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ inputs:
version:
description: "Version number"
required: true
NODE_AUTH_TOKEN:
description: "Token for access to github package registry"
required: true
runs:
using: "composite"
steps:
Expand All @@ -12,9 +15,12 @@ runs:
- uses: actions/setup-node@v4
with:
node-version: 22
registry-url: 'https://npm.pkg.github.com'

- name: Npm install
working-directory: .
env:
NODE_AUTH_TOKEN: ${{ inputs.NODE_AUTH_TOKEN }}
run: npm ci
shell: bash

Expand Down
6 changes: 6 additions & 0 deletions .github/actions/build-server/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ inputs:
version:
description: "Version number"
required: true
NODE_AUTH_TOKEN:
description: "Token for access to github package registry"
required: true
runs:
using: "composite"
steps:
Expand All @@ -12,9 +15,12 @@ runs:
- uses: actions/setup-node@v4
with:
node-version: 22
registry-url: 'https://npm.pkg.github.com'

- name: Npm install
working-directory: .
env:
NODE_AUTH_TOKEN: ${{ inputs.NODE_AUTH_TOKEN }}
run: npm ci
shell: bash

Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/manual-proxy-environment-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ on:

permissions:
contents: read
packages: read

jobs:
deploy-environment:
Expand All @@ -36,6 +37,8 @@ jobs:

- name: Npm install
working-directory: .
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm ci
shell: bash

Expand Down Expand Up @@ -87,3 +90,4 @@ jobs:
runId: "${{ github.run_id }}"
buildSandbox: ${{ inputs.build_sandbox }}
releaseVersion: ${{ github.ref_name }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 6 additions & 0 deletions .github/workflows/pr_closed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.nodejs_version }}
registry-url: 'https://npm.pkg.github.com'

- name: check if local version differs from latest published version
id: check-version
Expand Down Expand Up @@ -114,7 +115,10 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.nodejs_version }}
registry-url: 'https://npm.pkg.github.com'
- name: "Install dependencies"
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm ci
- name: "Run provider contract tests"
run: make test-contract
Expand Down Expand Up @@ -143,6 +147,8 @@ jobs:
registry-url: 'https://npm.pkg.github.com'

- name: Install dependencies
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm ci

- name: Publish to GitHub Packages
Expand Down
68 changes: 40 additions & 28 deletions .github/workflows/stage-1-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -237,34 +237,6 @@ jobs:
echo "Detected package version $version in main branch"
echo "main_version=$version" >> $GITHUB_OUTPUT

# check-schemas-generated:
# name: Check event schemas have been regenerated
# needs: detect-event-schema-package-changes
# if: needs.detect-event-schema-package-changes.outputs.changed == 'true'
# runs-on: ubuntu-latest
# permissions:
# contents: read
# steps:
# - name: "Checkout code"
# uses: actions/checkout@v4
#
# - name: "Cache node_modules"
# uses: actions/cache@v4
# with:
# path: |
# **/node_modules
# key: ${{ runner.os }}-node-${{ inputs.nodejs_version }}-${{ hashFiles('**/package-lock.json') }}
# restore-keys: |
# ${{ runner.os }}-node-${{ inputs.nodejs_version }}-
#
# - name: "Re-generate schemas"
# run: |
# npm ci
# npm --workspace internal/events run gen:jsonschema
#
# - name: Check for schema changes
# run: git diff --quiet internal/events/schemas

check-schema-version-change:
name: Check event schema version has been updated
needs: detect-event-schema-package-changes
Expand All @@ -290,3 +262,43 @@ jobs:
echo "Error: Event Schema package has changed, but new version ($local_version) is not a valid increment from latest version on main branch ($main_version)."
exit 1
fi

check-event-schemas-version-change:
name: Check for event schemas package version change
needs: detect-event-schema-package-changes
if: needs.detect-event-schema-package-changes.outputs.changed == 'true'
outputs:
version_changed: ${{ steps.check-version.outputs.version_changed }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
steps:
- name: Checkout code
uses: actions/checkout@v5.0.0

- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.nodejs_version }}
registry-url: 'https://npm.pkg.github.com'

- name: check if local version differs from latest published version
id: check-version
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
published_version=$(npm view @nhsdigital/nhs-notify-event-schemas-supplier-api --json 2>/dev/null | jq -r '.["dist-tags"].latest // "null"')
echo "Published version: $published_version"

local_version=$(jq -r '.version' internal/events/package.json)
echo "Local version: $local_version"

if [[ $local_version = $published_version ]]; then
echo "ERROR: Local version is the same as the latest published version, but event schemas have changed"
echo "version_changed=false" >> $GITHUB_OUTPUT
exit 1
else
echo "Local version is different to the latest published version - a new version will be published"
echo "version_changed=true" >> $GITHUB_OUTPUT
fi
9 changes: 9 additions & 0 deletions .github/workflows/stage-2-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ env:
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
packages: read # This is required for downloading from GitHub Package Registry

jobs:
check-generated-dependencies:
Expand All @@ -57,6 +58,8 @@ jobs:
restore-keys: |
${{ runner.os }}-node-${{ inputs.nodejs_version }}-
- name: "Repo setup"
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm ci
- name: "Generate dependencies"
Expand All @@ -79,6 +82,8 @@ jobs:
restore-keys: |
${{ runner.os }}-node-${{ inputs.nodejs_version }}-
- name: "Repo setup"
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm ci
- name: "Generate dependencies"
Expand Down Expand Up @@ -115,6 +120,8 @@ jobs:
restore-keys: |
${{ runner.os }}-node-${{ inputs.nodejs_version }}-
- name: "Repo setup"
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm ci
- name: "Generate dependencies"
Expand All @@ -139,6 +146,8 @@ jobs:
restore-keys: |
${{ runner.os }}-node-${{ inputs.nodejs_version }}-
- name: "Repo setup"
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm ci
- name: "Generate dependencies"
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/stage-3-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ on:
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
packages: read # This is required for downloading from GitHub Package Registry

jobs:
artefact-jekyll-docs:
name: "Build Docs"
Expand All @@ -51,6 +53,7 @@ jobs:
uses: ./.github/actions/build-docs
with:
version: "${{ inputs.version }}"
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

artefact-sdks:
name: "Build SDKs"
Expand All @@ -63,6 +66,7 @@ jobs:
uses: ./.github/actions/build-sdk
with:
version: "${{ inputs.version }}"
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Take out for now - might add again in the future
# artefact-servers:
Expand Down Expand Up @@ -133,3 +137,4 @@ jobs:
buildSandbox: true
releaseVersion: ${{ github.head_ref || github.ref_name }}
nodejs_version: ${{ inputs.nodejs_version }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@nhsdigital:registry=https://npm.pkg.github.com
Loading