Created
May 24, 2018 16:54
-
-
Save sgraham785/81a495c13ff0bdd8048c773839d3051e to your computer and use it in GitHub Desktop.
auto-git-tag the npm version when publishing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"postpublish" : "PACKAGE_VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]') && git tag $PACKAGE_VERSION && git push --tags" | |
} | |
} | |
Where node binary is available: | |
PACKAGE_VERSION=$(node -p -e "require('./package.json').version") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment