guess-npm-dist-tag
v0.0.6
Published
Automatically determine the dist-tag from the current latest and the new version number when `npm publish`
Downloads
2
Readme
guess-npm-dist-tag
Automatically determine the dist-tag from the current latest and the new version number when npm publish
.
Usage: CLI
$ npx guess-npm-dist-tag
latest
Compare the version number of the local package.json
in CWD with the latest version retrieved from the npm registry and output the most appropriate dist-tag like latest
, latest-3
ornext
.
You can use this with npm publish --tag
in GitHub Actions.
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
- run: npm ci
- run: npm publish --tag $(npx guess-npm-dist-tag)
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
See setup-node and "Publishing Node.js packages" in GitHub Docs.
License
MIT License: Teppei Sato <[email protected]>