Skip to content

Commit 376b352

Browse files
committed
CCM-13038: set GITHUB token when reading packages
1 parent ad336c3 commit 376b352

File tree

5 files changed

+26
-52
lines changed

5 files changed

+26
-52
lines changed

.github/workflows/stage-2-test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ jobs:
6060
- name: "Repo setup"
6161
env:
6262
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6364
run: |
6465
npm ci
6566
- name: "Generate dependencies"

pact-contracts/.gitignore

Lines changed: 0 additions & 24 deletions
This file was deleted.

pact-contracts/jest.config.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

pact-contracts/tsconfig.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

scripts/publish-pact-contracts.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
published_version=$(npm view @nhsdigital/notify-supplier-api-consumer-contracts --json 2>/dev/null | jq -r '.["dist-tags"].latest')
6+
7+
# Fail if there are uncommitted changes as this indicates unexpected changes to the contracts
8+
git diff --quiet tests/pact-tests
9+
10+
local_version=$(cat pact-contracts/package.json | jq -r '.version')
11+
12+
branch=$(git branch --show-current)
13+
14+
if [[ ! $branch == "feature/CCM-13038_pact-tests" ]]; then
15+
echo "Not publishing package because this is not the main branch"
16+
exit 0
17+
fi
18+
19+
if [[ $local_version == $published_version ]]; then
20+
echo "Local version is the same as the latest published version - skipping publish"
21+
exit 0
22+
fi
23+
24+
echo "Local version is different to the latest published version - publishing new version"
25+
npm publish ./pact-contracts

0 commit comments

Comments
 (0)