Created
January 9, 2019 16:03
-
-
Save boboben1/2bce59d87d01f5c75fdff2304807a876 to your computer and use it in GitHub Desktop.
Automatic git tagging for NPM
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
#!/bin/bash; C:/Program\ Files/Git/usr/bin/sh.exe | |
version=`git diff HEAD^..HEAD -- "$(git rev-parse --show-toplevel)"/package.json | grep '^\+.*version' | sed -s 's/[^0-9\.]//g'` | |
if [ "$version" != "" ]; then | |
git tag -a "v$version" -m "`git log -1 --format=%s`" | |
echo "Created a new tag, v$version" | |
fi | |
# Slightly modified from: https://coderwall.com/p/mk18zq/automatic-git-version-tagging-for-npm-modules |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment