Skip to content

Commit 41494aa

Browse files
authored
Use Node 24 for publish and fix OIDC auth handling (#794)
1 parent 20141c1 commit 41494aa

3 files changed

Lines changed: 21 additions & 7 deletions

File tree

.github/actions/setup/action.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
name: Setup
22

3+
inputs:
4+
node-version:
5+
description: Node.js version to use
6+
default: '22'
7+
38
runs:
49
using: composite
510
steps:
6-
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
11+
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
712
with:
8-
node-version: 22
13+
node-version: ${{ inputs.node-version }}
914
cache: yarn
1015
registry-url: 'https://registry.npmjs.org'
1116

.github/workflows/publish.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ jobs:
2121
ref: ${{ github.ref }}
2222
- name: Set up environment
2323
uses: ./.github/actions/setup
24-
- name: Install npm 11 for OIDC trusted publishing
25-
run: npm install -g npm@11.12.1
24+
with:
25+
node-version: '24'
2626
- name: Check for new packages
2727
id: check-packages
2828
run: |
@@ -61,10 +61,15 @@ jobs:
6161
echo "All packages exist on npm — using OIDC trusted publishing"
6262
fi
6363
echo "has_new_packages=$has_new_packages" >> "$GITHUB_OUTPUT"
64-
- name: Enable NPM token publishing
65-
if: steps.check-packages.outputs.has_new_packages == 'true'
66-
run: echo "NODE_AUTH_TOKEN=${NPM_TOKEN}" >> "$GITHUB_ENV"
64+
- name: Configure npm auth
65+
run: |
66+
if [ "$HAS_NEW_PACKAGES" = "true" ]; then
67+
echo "NODE_AUTH_TOKEN=${NPM_TOKEN}" >> "$GITHUB_ENV"
68+
else
69+
echo "NODE_AUTH_TOKEN=" >> "$GITHUB_ENV"
70+
fi
6771
env:
72+
HAS_NEW_PACKAGES: ${{ steps.check-packages.outputs.has_new_packages }}
6873
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
6974
- name: Create Prepare Release PR or Publish
7075
id: changesets

scripts/release/publish.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
set -euo pipefail
44

5+
if [ -z "${NODE_AUTH_TOKEN:-}" ]; then
6+
unset NODE_AUTH_TOKEN
7+
fi
8+
59
yarn install --frozen-lockfile
610
changeset publish
711
git push --follow-tags

0 commit comments

Comments
 (0)