Last active
August 29, 2015 14:23
-
-
Save mderazon/3385291c38cad22896b5 to your computer and use it in GitHub Desktop.
automatically create a tag for package version bump
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
# file: .git/config | |
# this pushes every branch that's already there, plus tags. It does not force push, and it does not push branch that we didn't push manually. | |
[remote "origin"] # or whatever it is named | |
url = ... | |
push = : | |
push = +refs/tags/*:refs/tags/* | |
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 | |
# file: .git/hooks/post-commit | |
version=`git diff HEAD^..HEAD -- "$(git rev-parse --show-toplevel)"/package.json | grep '^\+.*version' | sed '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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
post-commit
- each time there's a version update inpackage.json
it creates a tag with the new version numberconfig
- automatically pushes the tag along the commit to gh