Added pre- post-release hooks to git-release

This commit is contained in:
Tj Holowaychuk 2011-12-08 07:55:29 -08:00
parent cca7848b5b
commit c4e938d656
2 changed files with 12 additions and 0 deletions

View file

@ -249,9 +249,11 @@ $ git release 0.1.0
Does the following:
- Executes _.git/hooks/pre-release.sh_ (if present)
- Commits changes (to changelog etc) with message "Release <tag>"
- Tags with the given <tag>
- Push the branch / tags
- Executes _.git/hooks/post-release.sh_ (if present)
## git-alias

View file

@ -1,11 +1,21 @@
#!/usr/bin/env sh
hook() {
local hook=.git/hooks/$1.sh
if test -f $hook; then
echo "... $1"
. $hook
fi
}
if test $# -gt 0; then
hook pre-release
echo "... releasing $1"
git commit -a -m "Release $1" \
&& git tag $1 \
&& git push \
&& git push --tags \
&& hook post-release \
&& echo "... complete"
else
echo "tag required" && exit 1