Created
May 23, 2016 04:32
-
-
Save igorcosta/3754e5acc1d7f89469d39b1c293bfa61 to your computer and use it in GitHub Desktop.
Auto increment version of npm and git tagging
This file contains hidden or 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 | |
npm version patch | |
version=`git diff HEAD^..HEAD -- "$(git rev-parse --show-toplevel)"/package.json | grep '^\+.*version' | sed -s 's/[^0-9\.]//g'` | |
git add *; | |
git commit -m "Commit message" | |
if [ "$version" != "" ]; then | |
git tag -a "v$version" -m "`git log -1 --format=%s`" | |
echo "Created a new tag, v$version" | |
git push --tags | |
npm publish | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment