-
-
Notifications
You must be signed in to change notification settings - Fork 10
Publish a new package version to NPM
Vu Tong edited this page Dec 13, 2024
·
7 revisions
Follow these steps:
- Checkout local
main
branch - Increase package version
- Push commits and tags
- Trigger
publish-package
workflow
Checkout and make sure the local main
branch have the latest code.
git checkout main
git pull
NPM does not allow publishing the same version multiple times. So we need to increase to a new version when the package changes.
# The current version is 1.2.3
# Below are the new versions after running each command
# Increase major, minor, or patch number
npm version major # 2.0.0
npm version minor # 1.3.0
npm version patch # 1.2.4
# Specific a custom version
npm version 2.3.4 # 2.3.4
Learn more at https://docs.npmjs.com/cli/v10/commands/npm-version.
After increasing the package version, NPM will create a new commit and tag. We need to push them all before running the workflow to ensure the latest version will be used.
git push # Push commits
git push --tags # Push tags
Trigger and wait for the publish-package
to complete, and check if there are any errors. Verify the newest version available on NPM.
Once completed, you will receive a successful email.
Note: if you're facing deployment error like this, please update the NPM token in the repository secret.