diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b144a65..78354d1 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -17,7 +17,7 @@ jobs: steps: - uses: actions/checkout@v7 - # Trusted publishing needs npm >= 11.5.1; Node 24 bundles it. + # npm stage publish needs npm >= 11.15.0; current Node 24 bundles it. - uses: actions/setup-node@v7 with: node-version: '24.x' @@ -26,7 +26,7 @@ jobs: - run: npm ci - run: npm run test - run: npm run build - - run: npm publish --access=public - env: - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + # A maintainer approves the staged version (RELEASE.MD). npm logs + # trusted-publishing errors only at verbose level. + - run: npm stage publish --access=public --loglevel=verbose diff --git a/RELEASE.MD b/RELEASE.MD index 1d542ad..ebd4c83 100644 --- a/RELEASE.MD +++ b/RELEASE.MD @@ -6,12 +6,11 @@ This document describes the release process for the `deepinfra` package. Before release, make sure to do the following steps: - [ ] Update the `package.json` version number. You can use `npm version --allow-same-version --no-git-tag-version version_number` to update the version number. -- [ ] Create a new release on GitHub with the same version number. This runs `.github/workflows/deploy.yml`, which publishes to npm. +- [ ] Create a new release on GitHub with the same version number. This runs `.github/workflows/deploy.yml`, which stages the version on npm. +- [ ] Have a package maintainer approve the staged version with 2FA, on npmjs.com under Staged Packages or with `npm stage list deepinfra` and `npm stage approve `. Until then it can't be installed. ## npm authentication -The publish job signs in to npm with [trusted publishing](https://docs.npmjs.com/trusted-publishers). On npmjs.com, open the package's Settings, then Trusted publishing, and add GitHub Actions with organization `deepinfra`, repository `deepinfra-node` and workflow filename `deploy.yml`, with `npm publish` allowed. A new entry expires unless it publishes within 2 days, so add it right before a release. - -Without a trusted publisher the job falls back to the `NPM_TOKEN` repository secret. +The publish job signs in to npm with [trusted publishing](https://docs.npmjs.com/trusted-publishers) and only [stages](https://docs.npmjs.com/staged-publishing) the version. The trusted publisher is on npmjs.com under the package's Settings, then Trusted publishing: GitHub Actions with organization `deepinfra`, repository `deepinfra-node` and workflow filename `deploy.yml`, with `npm publish` unticked under Allowed actions, so nothing goes live without a maintainer's approval. If it ever has to be recreated, do it right before a release: a new entry expires unless a release uses it within 2 days.