@@ -15,26 +15,33 @@ jobs:
1515 steps :
1616 - uses : actions/checkout@v6
1717
18+ # Omit registry-url: setup-node otherwise sets NODE_AUTH_TOKEN to a placeholder and npm publish uses that instead of OIDC.
1819 - name : Setup Node
19- uses : actions/setup-node@v4
20+ uses : actions/setup-node@v6
2021 with :
21- node-version : 20
22- registry-url : https://registry.npmjs.org
22+ node-version : 22
23+ check-latest : true
2324 cache : npm
2425
26+ - name : Upgrade npm for trusted publishing (OIDC)
27+ run : npm install -g npm@">=11.5.1"
28+
2529 - name : Ensure versions match
2630 shell : bash
2731 run : |
2832 set -euo pipefail
2933 PKG_VERSION="$(node -p "require('./package.json').version")"
3034 JSR_VERSION="$(node -p "require('./jsr.json').version")"
3135 TAG_NAME="${{ github.event.release.tag_name }}"
36+ if [[ -z "$TAG_NAME" ]]; then
37+ TAG_NAME="v-${PKG_VERSION}"
38+ fi
3239 if [[ "$PKG_VERSION" != "$JSR_VERSION" ]]; then
3340 echo "Version mismatch: package.json=$PKG_VERSION, jsr.json=$JSR_VERSION"
3441 exit 1
3542 fi
36- if [[ "$TAG_NAME" != "v$PKG_VERSION" && "$TAG_NAME" != "$PKG_VERSION" ]]; then
37- echo "Release tag '$TAG_NAME' does not match version '$PKG_VERSION' (expected '$PKG_VERSION' or 'v$ PKG_VERSION')."
43+ if [[ "$TAG_NAME" != "v$PKG_VERSION" && "$TAG_NAME" != "$PKG_VERSION" && "$TAG_NAME" != "v-${PKG_VERSION}" ]]; then
44+ echo "Release tag '$TAG_NAME' does not match version '$PKG_VERSION' (expected '$PKG_VERSION', 'v$PKG_VERSION', or 'v-${ PKG_VERSION} ')."
3845 exit 1
3946 fi
4047
4552 run : npm publish --access public --provenance
4653
4754 - name : Publish to JSR
48- run : |
49- # Trusted publishing should authenticate via OIDC; token is intentionally not required here.
50- npx jsr publish --provenance
55+ run : npx jsr publish
5156
0 commit comments