From 7edf381f897a9fab697c9d7f7dfbb2ce6b61d6a4 Mon Sep 17 00:00:00 2001 From: Kevin Date: Mon, 4 May 2026 16:06:03 +0200 Subject: [PATCH 1/2] fix(ci): use Node 24 for publish workflow to avoid broken npm self-upgrade MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 5.7.3 publish run failed at the "Ensure npm >= 11.5.1" step because `npm install -g npm@latest` crashes with `Cannot find module 'promise-retry'` on Node 22.22.2 — a known regression in npm self-upgrade on hosted runners. Switch the publish job to Node 24, which already ships with npm 11.x, so the explicit upgrade step is no longer needed. Replace it with a guard that fails fast if the bundled npm ever falls below 11.5.1 (required for npm Trusted Publishing). Also add a workflow_dispatch trigger with a tag input so the publish can be retriggered for an existing release tag without recreating the GitHub release. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/publish.yml | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6d219ce..c18c23b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -3,6 +3,12 @@ name: Publish to npm on: release: types: [published] + workflow_dispatch: + inputs: + tag: + description: "Release tag to publish (e.g. 5.7.3)" + required: true + type: string permissions: contents: read @@ -25,15 +31,26 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.tag || github.ref }} - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: "22" + node-version: "24" registry-url: "https://registry.npmjs.org" - - name: Ensure npm >= 11.5.1 (required for trusted publishing) - run: npm install -g npm@latest + - name: Verify npm version (>= 11.5.1 required for trusted publishing) + run: | + NPM_VERSION=$(npm --version) + echo "npm version: $NPM_VERSION" + node -e " + const [maj, min, patch] = process.argv[1].split('.').map(Number); + if (maj < 11 || (maj === 11 && (min < 5 || (min === 5 && patch < 1)))) { + console.error('npm ' + process.argv[1] + ' is below required 11.5.1'); + process.exit(1); + } + " "$NPM_VERSION" - name: Build all packages run: | @@ -43,7 +60,7 @@ jobs: - name: Verify versions match release tag run: | - TAG="${GITHUB_REF_NAME}" + TAG="${{ github.event.inputs.tag || github.ref_name }}" for PKG in packages/purchasely packages/google packages/amazon packages/huawei packages/android-player; do VERSION=$(node -p "require('./$PKG/package.json').version") if [ "$VERSION" != "$TAG" ]; then From e878cb56862824b8af2ffc4f3da5f39832180b49 Mon Sep 17 00:00:00 2001 From: Kevin Date: Mon, 4 May 2026 16:11:35 +0200 Subject: [PATCH 2/2] fix(ci): simplify npm version guard with sort -V Replace the inline node -e version check with a sort -V comparison. The previous version worked on Node 22+ (process.argv[1] is the first user arg when using `-e` since there's no script-file entry), but the indexing differs from script-file invocation and was easy to misread. The bash sort -V approach is unambiguous and platform-agnostic. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/publish.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c18c23b..aeab902 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -42,15 +42,12 @@ jobs: - name: Verify npm version (>= 11.5.1 required for trusted publishing) run: | - NPM_VERSION=$(npm --version) + NPM_VERSION="$(npm --version)" echo "npm version: $NPM_VERSION" - node -e " - const [maj, min, patch] = process.argv[1].split('.').map(Number); - if (maj < 11 || (maj === 11 && (min < 5 || (min === 5 && patch < 1)))) { - console.error('npm ' + process.argv[1] + ' is below required 11.5.1'); - process.exit(1); - } - " "$NPM_VERSION" + if [ "$(printf '%s\n%s\n' "11.5.1" "$NPM_VERSION" | sort -V | head -n1)" != "11.5.1" ]; then + echo "::error::npm $NPM_VERSION is below required 11.5.1" + exit 1 + fi - name: Build all packages run: |