From de5564266658fcfcbec3602efecd449fbd34ed06 Mon Sep 17 00:00:00 2001 From: Simon Karman Date: Fri, 4 Jul 2025 14:03:04 +0200 Subject: [PATCH 1/2] Moved version check to a bash file so it can be ran locally too --- .github/tools/version-check.sh | 17 +++++++++++++++++ .github/workflows/version.yml | 21 +-------------------- package.json | 4 ++-- 3 files changed, 20 insertions(+), 22 deletions(-) create mode 100755 .github/tools/version-check.sh diff --git a/.github/tools/version-check.sh b/.github/tools/version-check.sh new file mode 100755 index 0000000..871ac21 --- /dev/null +++ b/.github/tools/version-check.sh @@ -0,0 +1,17 @@ +echo "Verifying that all packages have the same major and minor version (patch version can be different)..." +version_base=$(cat package.json | jq '.version' --raw-output) +version_base=${version_base%.*} +echo "Base Version: $version_base" + +find . -name "package.json" -type f -not -path "*/node_modules/*" -not -path "*/.next/*" -not -path "*/state/*" | sort | while read -r file; do + name_pkg=$(cat $file | jq '.name' --raw-output) + version_pkg_original=$(cat $file | jq '.version' --raw-output) + version_pkg="${version_pkg_original%.*}" + + if [ "$version_base" != "$version_pkg" ]; then + echo "- $name_pkg: ❌ mismatch! (at $version_pkg_original)" + exit 1 + else + echo "- $name_pkg: ✅ correct at $version_pkg_original" + fi +done diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml index c2ed9e5..cea30e7 100644 --- a/.github/workflows/version.yml +++ b/.github/workflows/version.yml @@ -12,23 +12,4 @@ jobs: steps: - uses: actions/checkout@v4 - name: Check versions - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - run: | - echo "Verifying that all packages have the same major and minor version (patch version can be different)..." - version_base=$(cat package.json | jq '.version' --raw-output) - version_base=${version_base%.*} - echo "Base Version: $version_base" - - find . -name "package.json" -type f -not -path "*/node_modules/*" -not -path "*/.next/*" -not -path "*/state/*" | sort | while read -r file; do - name_pkg=$(cat $file | jq '.name' --raw-output) - version_pkg=$(cat $file | jq '.version' --raw-output) - version_pkg="${version_pkg%.*}" - - if [ "$version_base" != "$version_pkg" ]; then - echo "- $name_pkg: mismatch! (at $version_pkg)" - exit 1 - else - echo "- $name_pkg: correct" - fi - done + run: ../.github/tools/version-check.sh diff --git a/package.json b/package.json index d183217..65f0bde 100644 --- a/package.json +++ b/package.json @@ -7,14 +7,14 @@ "scripts": { "postinstall": "npm --prefix base install && npm --prefix server install && npm --prefix client install && npm --prefix client-react install && npm --prefix state install && npm --prefix docs install", "audit:fix": "npm --prefix base audit fix && npm --prefix server audit fix && npm --prefix client audit fix && npm --prefix client-react audit fix && npm --prefix state run audit:fix && npm --prefix docs audit fix", - "validate": "npm install && npm run --prefix base validate && npm run --prefix server validate && npm run --prefix client validate && npm run --prefix client-react validate && npm run --prefix state validate && npm run --prefix docs validate", + "validate": "npm install && .github/tools/version-check.sh && npm run --prefix base validate && npm run --prefix server validate && npm run --prefix client validate && npm run --prefix client-react validate && npm run --prefix state validate && npm run --prefix docs validate", "dev": "npm-run-all --parallel dev:*", "dev:base": "npm run --prefix base dev", "dev:server": "sleep 250 && npm run --prefix server dev", "dev:client": "sleep 500 && npm run --prefix client dev", "dev:client-react": "sleep 750 && npm run --prefix client-react dev", "dev:docs": "npm run --prefix docs dev", - "versions": "npm install && npm --prefix base run postversion && npm --prefix server run postversion && npm --prefix client run postversion && npm --prefix client-react run postversion && npm --prefix state run versions" + "versions": ".github/tools/version-check.sh && npm install && npm --prefix base run postversion && npm --prefix server run postversion && npm --prefix client run postversion && npm --prefix client-react run postversion && npm --prefix state run versions" }, "dependencies": { "npm-run-all": "^4.1.5", From 70087630c72cfa4543284dbf00b5e1f2a6a457e5 Mon Sep 17 00:00:00 2001 From: Simon Karman Date: Fri, 4 Jul 2025 14:05:59 +0200 Subject: [PATCH 2/2] Fixed tool location in version Github Action --- .github/workflows/version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml index cea30e7..07baad8 100644 --- a/.github/workflows/version.yml +++ b/.github/workflows/version.yml @@ -12,4 +12,4 @@ jobs: steps: - uses: actions/checkout@v4 - name: Check versions - run: ../.github/tools/version-check.sh + run: .github/tools/version-check.sh