Last active
December 24, 2015 19:02
-
-
Save supersha/61f3ca2322f10d170cb8 to your computer and use it in GitHub Desktop.
命令行直接发布当前的git分支到日常/线上
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 | |
gitStatus=`git status | grep -E 'On branch daily\/(\d+\.\d+\.\d+)'` | |
currentBranch=${gitStatus/On branch daily\//} | |
while getopts "v:m:o" arg | |
do | |
case $arg in | |
v) | |
#echo "v's arg:$OPTARG" | |
#echo $VERSION | |
version=$OPTARG | |
;; | |
e) | |
#execute script | |
executescript=$OPTARG | |
;; | |
m) | |
comment=$OPTARG | |
;; | |
o) | |
#printf "\n\E[1;33m#:#:#:#: Publish to online :#:#:#:#\E[0m\n" | |
pubonline=true | |
;; | |
c) | |
#build config | |
buildconfig=true | |
;; | |
?) | |
echo "unknow argument" | |
exit 1 | |
;; | |
esac | |
done | |
#echo $version | |
if [ "$comment" = "" ]; then | |
comment="by xipeng" | |
fi | |
gitBranch="daily/$currentBranch" | |
if [ $version ]; then | |
gitBranch=$version | |
fi | |
printf "\E[1;32m#:#:#:#: Current Branch $gitBranch :#:#:#:#\E[0m\n" | |
git pull | |
if [ $executescript ]; then | |
$executescript | |
fi | |
if [ $buildconfig ]; then | |
tap buildcfg | |
fi | |
tap build | |
git add -A | |
git commit -m "$comment" | |
git push origin $gitBranch | |
if [ $pubonline ]; then | |
printf "\n\E[1;33m#:#:#:#: Publish to online :#:#:#:#\E[0m\n" | |
git tag publish/$currentBranch | |
git push origin publish/$currentBranch | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment