Skip to content

Commit cfd55c3

Browse files
committed
fix: restore setup-node registry-url but remove .npmrc to support OIDC
1 parent aedab6b commit cfd55c3

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
uses: actions/setup-node@v4
2020
with:
2121
node-version: '20'
22+
registry-url: 'https://registry.npmjs.org'
2223

2324
- name: Install dependencies
2425
run: yarn install
@@ -30,11 +31,15 @@ jobs:
3031
# It will only publish if the version in package.json is new
3132
# Note: Trusted Publishing requires permissions: id-token: write
3233
run: |
33-
echo "registry=https://registry.npmjs.org/" > .npmrc
34+
# setup-node creates an .npmrc with an empty token which breaks Trusted Publishing
35+
# We need to remove it but keep the registry configuration
36+
rm -f .npmrc
37+
npm config set registry https://registry.npmjs.org/
38+
3439
PACKAGE_NAME=$(node -p "require('./package.json').name")
3540
PACKAGE_VERSION=$(node -p "require('./package.json').version")
3641
if npm view "$PACKAGE_NAME" version | grep -q "$PACKAGE_VERSION"; then
3742
echo "Version $PACKAGE_VERSION already exists on NPM. Skipping publish."
3843
else
39-
npm publish --provenance --access public --verbose --registry https://registry.npmjs.org/
44+
npm publish --provenance --access public --verbose
4045
fi

0 commit comments

Comments
 (0)