diff --git a/li.strolch.dev/setVersion.sh b/li.strolch.dev/setVersion.sh index be097769f..a5b428f01 100755 --- a/li.strolch.dev/setVersion.sh +++ b/li.strolch.dev/setVersion.sh @@ -6,8 +6,9 @@ if [ ! $(which xmlstarlet) ] ; then fi function usage() { - echo "Usage: $0 [-c] [-o ] [-n ]" 1>&2; + echo "Usage: $0 [-c] [-p] [-o ] [-n ]" 1>&2; echo " -c commit" + echo " -p push to origin" echo " -o old version e.g. 1.0.0-SNAPSHOT" echo " -n new version e.g. 1.0.0-RC3" echo "" @@ -20,6 +21,9 @@ while getopts ":b:o:n:r:cp" arg; do c) c="true" ;; + p) + p="true" + ;; o) o=${OPTARG} ;; @@ -52,6 +56,7 @@ fi old_version="${o}" new_version="${n}" commit="${c}" +push="${p}" declare SCRIPT_NAME="${0##*/}" declare SCRIPT_DIR="$(cd ${0%/*} ; pwd)" @@ -130,8 +135,16 @@ if [ -n "${commit}" ] ; then echo "INFO: Committing new version ${new_version}" git submodule foreach git add . 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 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 echo "INFO: NOT committing new version" fi