tj.git-extras/bin/git-release
2014-12-03 00:57:41 +08:00

32 lines
543 B
Bash
Executable file

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