[Project] allow pushing of new version as well

This commit is contained in:
Robert von Burg 2015-03-02 14:33:13 +01:00
parent e961aa8cd3
commit f0de30d701
1 changed files with 14 additions and 1 deletions

View File

@ -6,8 +6,9 @@ if [ ! $(which xmlstarlet) ] ; then
fi fi
function usage() { function usage() {
echo "Usage: $0 [-c] [-o <old_version>] [-n <new_version>]" 1>&2; echo "Usage: $0 [-c] [-p] [-o <old_version>] [-n <new_version>]" 1>&2;
echo " -c commit" echo " -c commit"
echo " -p push to origin"
echo " -o <old_version> old version e.g. 1.0.0-SNAPSHOT" echo " -o <old_version> old version e.g. 1.0.0-SNAPSHOT"
echo " -n <new_version> new version e.g. 1.0.0-RC3" echo " -n <new_version> new version e.g. 1.0.0-RC3"
echo "" echo ""
@ -20,6 +21,9 @@ while getopts ":b:o:n:r:cp" arg; do
c) c)
c="true" c="true"
;; ;;
p)
p="true"
;;
o) o)
o=${OPTARG} o=${OPTARG}
;; ;;
@ -52,6 +56,7 @@ fi
old_version="${o}" old_version="${o}"
new_version="${n}" new_version="${n}"
commit="${c}" commit="${c}"
push="${p}"
declare SCRIPT_NAME="${0##*/}" declare SCRIPT_NAME="${0##*/}"
declare SCRIPT_DIR="$(cd ${0%/*} ; pwd)" declare SCRIPT_DIR="$(cd ${0%/*} ; pwd)"
@ -130,8 +135,16 @@ if [ -n "${commit}" ] ; then
echo "INFO: Committing new version ${new_version}" echo "INFO: Committing new version ${new_version}"
git submodule foreach git add . git submodule foreach git add .
git submodule foreach git commit -m "[Project] Bumped version from ${old_version} to ${new_version}" git submodule foreach git commit -m "[Project] Bumped version from ${old_version} to ${new_version}"
if [ -n "${push}" ] ; then
echo "INFO: Pushing submodules to origin..."
git submodule foreach git push origin
fi
git add . git add .
git commit -m "[Project] Bumped version from ${old_version} to ${new_version}" git commit -m "[Project] Bumped version from ${old_version} to ${new_version}"
if [ -n "${push}" ] ; then
echo "INFO: Pushing to origin..."
git push origin
fi
else else
echo "INFO: NOT committing new version" echo "INFO: NOT committing new version"
fi fi