Skip to content

Commit e0c26d1

Browse files
committed
Add version check and Node.js setup to CI workflow
1 parent 56b56b5 commit e0c26d1

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ jobs:
272272
runs-on: ubuntu-latest
273273
permissions:
274274
contents: read
275+
packages: read
275276
steps:
276277
- name: Checkout code
277278
uses: actions/checkout@v4
@@ -290,3 +291,25 @@ jobs:
290291
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)."
291292
exit 1
292293
fi
294+
295+
- name: Setup NodeJS
296+
uses: actions/setup-node@v4
297+
with:
298+
node-version: ${{ inputs.nodejs_version }}
299+
300+
- name: Check if local version differs from latest published version
301+
id: check-version
302+
run: |
303+
published_version=$(npm view @nhsdigital/nhs-notify-event-schemas-supplier-api --json 2>/dev/null | jq -r '.["dist-tags"].latest // "null"')
304+
echo "Published version: $published_version"
305+
306+
local_version=$(jq -r '.version' internal/events/package.json)
307+
echo "Local version: $local_version"
308+
309+
if [[ $local_version = $published_version ]]; then
310+
echo "Local version is the same as the latest published version - skipping publish"
311+
echo "version_changed=false" >> $GITHUB_OUTPUT
312+
else
313+
echo "Local version is different to the latest published version - publishing new version"
314+
echo "version_changed=true" >> $GITHUB_OUTPUT
315+
fi

0 commit comments

Comments
 (0)