Skip to content

Commit ac021ef

Browse files
committed
fix(ci): publish to npm natively with --provenance
@semantic-release/npm's --userconfig flag overrides OIDC auth. Disable npm publish in semantic-release (npmPublish: false) and publish separately with native npm publish --provenance which handles OIDC correctly.
1 parent f79e095 commit ac021ef

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,18 @@ jobs:
9595
turbo-release-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}-
9696
turbo-release-${{ runner.os }}-
9797
- run: npx turbo run _compile _schema
98+
- name: Record pre-release version
99+
id: pre
100+
run: echo "version=$(npm pkg get version | tr -d '\"')" >> "$GITHUB_OUTPUT"
98101
- run: npx semantic-release
99102
env:
100103
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
101-
NODE_AUTH_TOKEN: ""
104+
- name: Publish to npm via OIDC
105+
run: |
106+
CURRENT=$(npm pkg get version | tr -d '"')
107+
if [ "$CURRENT" != "${{ steps.pre.outputs.version }}" ]; then
108+
echo "Publishing $CURRENT to npm..."
109+
npm publish --provenance --access public
110+
else
111+
echo "No new version — skipping npm publish"
112+
fi

release.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export default {
3535
],
3636
},
3737
}],
38-
["@semantic-release/npm", { npmPublish: true }],
38+
["@semantic-release/npm", { npmPublish: false }],
3939
"@semantic-release/changelog",
4040
["@semantic-release/git", {
4141
assets: ["CHANGELOG.md", "package.json"],

0 commit comments

Comments
 (0)