Created
September 4, 2013 11:51
-
-
Save nagachika/6435944 to your computer and use it in GitHub Desktop.
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
function echo_and_exec() { | |
echo $* | |
$* | |
ST=$? | |
if [ $ST -ne 0 ]; | |
then | |
echo "エラー: exitstatus: ${ST}" | |
return 1 | |
fi | |
} | |
function release_project() { | |
git status | grep 'nothing to commit (working directory clean)' > /dev/null | |
if [ $? -ne 0 ]; | |
then | |
echo "リポジトリに作業中の内容があります。クリーンにしてから再実行してください" | |
return | |
fi | |
YEAR=`date '+%Y'` | |
MONTH=`date '+%m'` | |
DAY=`date '+%d'` | |
TAG=release-${YEAR}${MONTH}${DAY} | |
echo_and_exec git checkout develop && \ | |
echo_and_exec git pull origin develop && \ | |
echo_and_exec git checkout master && \ | |
echo_and_exec git pull origin develop && \ | |
echo_and_exec git merge develop && \ | |
echo_and_exec git push origin master && \ | |
echo_and_exec git checkout release && \ | |
echo_and_exec git pull origin release && \ | |
echo_and_exec git merge master && \ | |
echo_and_exec git push origin release | |
if [ $ST -ne 0 ]; | |
then | |
echo "エラー: exitstatus: ${ST}" | |
return 1 | |
fi | |
git tag --list | grep -w ${TAG} > /dev/null | |
ST=$? | |
if [ $ST -eq 0 ]; | |
then | |
git tag -d ${TAG} | |
fi | |
echo_and_exec git tag -a ${TAG} -m "${YEAR}-${MONTH}-${DAY}リリース" && \ | |
echo_and_exec git push --tags | |
ST=$? | |
if [ $ST -ne 0 ]; | |
then | |
echo "エラー: exitstatus: ${ST}" | |
return 1 | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment