When you publish a new version of your package on npmjs.com with npm version, you can automatically push the version upgrade to your upstream repository as well – thanks to npm scripts!

Add a npm script postversion: git push --follow-tags and you are good to go.

Whenever you made a npm version major, npm version minor, or npm version patch, a new commit will be added to your upstream repository as well, mentioning this version upgrade.

Check this out – it has a freeCodeCamp blog link for a primer on npm scripts!

Published by Arun

Happiness Engineer, Automattic; Prev, Freshworks Inc