Skip to content

Commit 00c269d

Browse files
committed
Setup trusted publishing
1 parent 37ec58b commit 00c269d

4 files changed

Lines changed: 8 additions & 6 deletions

File tree

.github/workflows/release.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ jobs:
2323
with:
2424
node-version-file: package.json
2525
cache: pnpm
26+
registry-url: 'https://registry.npmjs.org'
27+
- run: pnpm add -g npm@latest
2628
- run: pnpm install
2729
- run: ./release-it.sh
2830
env:
29-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
3031
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and 
77

88
## [Unreleased]
99

10+
### Changed
11+
12+
- The package now uses [trusted publishing](https://docs.npmjs.com/trusted-publishers) instead of NPM tokens. You should remove the line with `NPM_TOKEN` from your release pipeline (and also remove the `NPM_TOKEN` from secrets of your repository) and add a line with `registry-url: 'https://registry.npmjs.org'` (see the changes to the `release.yaml` file as an example).
13+
1014
## [3.0.0] — 2025–09–24
1115

1216
### Changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ Or add running with two secret tokens in your CI pipeline:
2525
```yaml
2626
- run: pnpm dlx @firefoxic/release-it
2727
env:
28-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
2928
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3029
```
3130

release-it.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ validate_release_branch() {
3434

3535
setup_authentication() {
3636
if [[ "${CI:-}" == "true" ]]; then
37-
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ~/.npmrc
38-
3937
git config --global user.email "actions@users.noreply.github.com"
4038
git config --global user.name "GitHub Actions"
4139
else
@@ -168,7 +166,7 @@ update-changelog() {
168166

169167
publish_to_npm() {
170168
if [[ "${CI:-}" == "true" ]]; then
171-
pnpm publish --provenance --access public --no-git-checks
169+
npm publish --provenance --access public --no-git-checks
172170
else
173171
pnpm publish --access public --no-git-checks --otp="$NPM_OTP"
174172
fi
@@ -225,7 +223,7 @@ VERSION DETECTION:
225223
226224
AUTHENTICATION:
227225
• Local: Enter OTP interactively
228-
• CI: Uses NPM_TOKEN secret automatically
226+
• CI: Uses NPM trusted publishing
229227
• GitHub Release: Requires 'gh auth login' or GITHUB_TOKEN
230228
231229
EXAMPLES:

0 commit comments

Comments
 (0)