Skip to content

Commit 6257b2d

Browse files
shannahclaude
andauthored
fix: pin npm to v11 and bump Node to 22.x to avoid npm@latest engine break (#469)
npm published v12.0.0 as "latest", which requires Node ^22.22.2 || ^24.15.0 || >=26. The action provisioned Node 20.x and ran `npm install -g npm@latest`, so every consumer pinned to shannah/jdeploy@master started failing with EBADENGINE the moment npm 12 shipped, with no change on their side. - Pin the upgrade to `npm@11` instead of tracking `npm@latest` so a future npm major with a higher Node engine requirement can't silently break the action again. - Bump Node from 20.x to 22.x, clearing the runner's Node 20 deprecation warning while staying compatible with npm 11's trusted-publishing (OIDC). - Gate the npm upgrade in action.yml on `deploy_target == 'npm'` since trusted publishing is npm-registry-only; GitHub-only releases skip it. Applied the same pin/Node bump to the internal maven.yml release workflow. Co-authored-by: Claude <noreply@anthropic.com>
1 parent c103669 commit 6257b2d

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

‎.github/workflows/maven.yml‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ jobs:
3333
- name: Set up Node
3434
uses: actions/setup-node@v4
3535
with:
36-
node-version: '20.x'
36+
node-version: '22.x'
3737
- name: Upgrade npm for trusted publishing
38-
run: npm install -g npm@latest
38+
# Pin the npm major version instead of tracking npm@latest so a new npm
39+
# release with a higher Node engine requirement can't break this step.
40+
run: npm install -g npm@11
3941
- name: Install PHP
4042
run: |
4143
brew update

‎action.yml‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,16 @@ runs:
119119
if: ${{ env.JDEPLOY_SKIP_EXECUTION != 'true' }}
120120
uses: actions/setup-node@v4
121121
with:
122-
node-version: '20.x'
122+
node-version: '22.x'
123123
registry-url: 'https://registry.npmjs.org'
124124

125125
- name: Upgrade npm for trusted publishing
126-
if: ${{ env.JDEPLOY_SKIP_EXECUTION != 'true' }}
127-
run: npm install -g npm@latest
126+
# Only needed for npm trusted publishing (OIDC provenance); GitHub
127+
# releases don't use it. Pin the major version rather than tracking
128+
# npm@latest so a new npm release with a higher Node engine requirement
129+
# can't break this step without a Node bump here.
130+
if: ${{ env.JDEPLOY_SKIP_EXECUTION != 'true' && inputs.deploy_target == 'npm' }}
131+
run: npm install -g npm@11
128132
shell: bash
129133

130134
- name: Setup jDeploy Registry

0 commit comments

Comments
 (0)