Skip to content

Commit 6c562c5

Browse files
committed
ci: switch npm publishing to trusted publishing
Remove token-based npm authentication from the release workflow so CI can publish through npm Trusted Publishing with GitHub OIDC. Update the release guide to document the npm-side trusted publisher setup and clarify that no NPM_TOKEN secret is required.
1 parent 1cb0a21 commit 6c562c5

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

.github/workflows/release.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ jobs:
5656
- name: Publish package to npm
5757
if: steps.resolve.outputs.should_publish == 'true'
5858
run: npm publish --provenance --tag "${{ steps.resolve.outputs.publish_tag }}"
59-
env:
60-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
6159

6260
- name: Release summary
6361
run: |

docs/setup/RELEASING.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,22 @@ NomadWorks publishes to npm as `@neuralnomads/nomadworks`.
77
- Versioning, build verification, and npm publishing are handled by the GitHub Actions workflow `Release npm package`.
88
- Pushes to `dev` automatically publish npm prereleases.
99
- Pushes to `main` automatically publish stable npm releases.
10+
- GitHub Actions publishes through npm Trusted Publishing with provenance enabled.
1011
- The workflow does not commit or tag version changes back to the repository. It derives the publish version from `package.json` and npm's already-published versions.
1112

12-
## Required Repository Secret
13+
## Trusted Publishing Setup
1314

14-
Add this repository secret before publishing:
15+
Configure npm Trusted Publishing for this GitHub repository before relying on CI publishes.
1516

16-
- `NPM_TOKEN`: npm access token with permission to publish `@neuralnomads/nomadworks`
17+
At a minimum, npm must trust this repository's GitHub Actions workflow as a publisher for `@neuralnomads/nomadworks`.
18+
19+
Expected setup:
20+
21+
1. Open the npm package settings for `@neuralnomads/nomadworks`.
22+
2. Configure a Trusted Publisher for this GitHub repository.
23+
3. Allow GitHub Actions from this repository to publish the package.
24+
25+
No `NPM_TOKEN` repository secret is required once Trusted Publishing is configured correctly.
1726

1827
## Workflow Behavior
1928

@@ -24,7 +33,7 @@ The release workflow performs these steps:
2433
3. Runs `npm run release:check`, which executes tests, builds `dist/`, and previews the publish tarball.
2534
4. Resolves the publish version based on the current branch and npm registry history.
2635
5. Applies that version locally with `npm version --no-git-tag-version`.
27-
6. Publishes the package with `npm publish --provenance`.
36+
6. Publishes the package with `npm publish --provenance` using npm Trusted Publishing.
2837

2938
## Branch Behavior
3039

@@ -79,4 +88,5 @@ This command:
7988
- `prepack` runs `npm run build`, so local `npm pack` and `npm publish` always include a fresh `dist/` build.
8089
- `publishConfig.access` is set to `public` so the scoped package can publish correctly on npm.
8190
- The prerelease counter is remembered via npm registry history, not via git tags or committed prerelease versions.
91+
- CI publishing depends on npm Trusted Publishing plus the workflow permission `id-token: write`.
8292
- If you need to dry-run a release locally without publishing, use `npm run release:check` and inspect the tarball preview output.

0 commit comments

Comments
 (0)