File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -509,17 +509,18 @@ jobs:
509509 run : yarn artifacts
510510 - name : Move README # Hack to get npm README to work
511511 run : cp README.md ../README.md
512+ - name : Compute npm dist-tag
513+ # Prerelease versions (e.g. 1.0.0-rc.1) must publish under a non-`latest`
514+ # dist-tag — npm 11.5+ refuses otherwise. Stable versions go to `latest`.
515+ id : npm_tag
516+ if : github.event_name == 'workflow_dispatch' || startsWith(github.event.ref, 'refs/tags/v')
517+ run : |
518+ echo "tag=$(node -p "/-/.test(require('./package.json').version) ? 'next' : 'latest'")" >> "$GITHUB_OUTPUT"
512519 - name : Publish
513520 # Auth via npm Trusted Publishing (OIDC, no token). Configured per-package
514521 # at https://www.npmjs.com/package/<pkg>/access → Trusted publishers.
515- # NPM_CONFIG_TAG: pre-1.0 versions (anything semver-prerelease, e.g.
516- # 1.0.0-rc.1) must be published under a non-`latest` dist-tag — npm
517- # 11.5+ refuses the publish otherwise. `next` is the existing dist-tag
518- # this package uses for prereleases. Bare `npm install @number0/iroh`
519- # keeps resolving to the previous stable until a 1.0.0 release without
520- # this env is cut.
521522 if : github.event_name == 'workflow_dispatch' || startsWith(github.event.ref, 'refs/tags/v')
522523 run : npm publish --access public --provenance
523524 env :
524525 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
525- NPM_CONFIG_TAG : next
526+ NPM_CONFIG_TAG : ${{ steps.npm_tag.outputs.tag }}
You can’t perform that action at this time.
0 commit comments