diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4b18d6d..05e3e94 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -73,6 +73,9 @@ jobs: npm: needs: release + # Automatic publishing stays off until the repository sets this variable + # together with a valid NPM_TOKEN. Manual `npm publish` works without it. + if: ${{ vars.NPM_AUTOPUBLISH == 'true' }} runs-on: ubuntu-latest permissions: contents: read @@ -88,8 +91,8 @@ jobs: cache: npm - run: npm ci - run: npm run build - # Set an NPM_TOKEN repository secret to publish automatically. Without - # it the step is skipped and the tarball remains on the GitHub release. + # Automatic publishing also needs NPM_AUTOPUBLISH=true and a valid + # NPM_TOKEN secret. Otherwise publish the release tarball manually. - name: publish to npm if: ${{ env.NODE_AUTH_TOKEN != '' }} run: npm publish --ignore-scripts --provenance --access public diff --git a/docs/RELEASING.md b/docs/RELEASING.md index 91ac4ea..5f7ea0c 100644 --- a/docs/RELEASING.md +++ b/docs/RELEASING.md @@ -43,9 +43,9 @@ and `SHA256SUMS.txt`, packs the npm tarball, and optionally publishes to npm. ``` 5. The workflow creates the GitHub release and uploads the host archive, - checksums and npm tarball. To publish to npm automatically, add an - `NPM_TOKEN` repository secret (`npm token create`); otherwise download the - tarball from the release and run `npm publish`. + checksums and npm tarball. To publish to npm automatically, set the + repository variable `NPM_AUTOPUBLISH` to `true` and add a valid `NPM_TOKEN` + repository secret; otherwise publish manually with `npm publish`. 6. Upload `assets/social-card.png` as the repository social preview in GitHub settings if the card changed. GitHub has no API for that image.