diff --git a/ch.eitchnet.parent b/ch.eitchnet.parent index dc3beef5b..8498efc8f 160000 --- a/ch.eitchnet.parent +++ b/ch.eitchnet.parent @@ -1 +1 @@ -Subproject commit dc3beef5bfb45608217914e4bc1a45e2935f3dd3 +Subproject commit 8498efc8fe502250ea089cd71c5523b2477c8d56 diff --git a/ch.eitchnet.privilege b/ch.eitchnet.privilege index a70b43098..c8816472f 160000 --- a/ch.eitchnet.privilege +++ b/ch.eitchnet.privilege @@ -1 +1 @@ -Subproject commit a70b4309860cd3da8f22b20b4589973c115bb238 +Subproject commit c8816472fcd89225178b66fad782ad49f83f181d diff --git a/ch.eitchnet.utils b/ch.eitchnet.utils index 54092c87d..afcb7c41f 160000 --- a/ch.eitchnet.utils +++ b/ch.eitchnet.utils @@ -1 +1 @@ -Subproject commit 54092c87d4a5e3eaf0c4cae894367cfafaecad15 +Subproject commit afcb7c41fc57548f76857a4dd2b868ca0d5b042b diff --git a/ch.eitchnet.xmlpers b/ch.eitchnet.xmlpers index cf1a61353..c3fe4bdec 160000 --- a/ch.eitchnet.xmlpers +++ b/ch.eitchnet.xmlpers @@ -1 +1 @@ -Subproject commit cf1a6135350c6097aad14bfc98a93fdfe5f4d697 +Subproject commit c3fe4bdec64d1eb56c28f9df0e19a7c7bbc570c7 diff --git a/release.sh b/release.sh new file mode 100755 index 000000000..13168a27f --- /dev/null +++ b/release.sh @@ -0,0 +1,148 @@ +#!/bin/bash + +function usage() { + echo "Usage: $0 [-c] [-r ] [-b ] [-o ] [-n ]" 1>&2; + exit 1; +} + +while getopts ":b:o:n:r:c" arg; do + case "${arg}" in + c) + c="true" + ;; + r) + r=${OPTARG} + ;; + b) + b=${OPTARG} + ;; + o) + o=${OPTARG} + ;; + n) + n=${OPTARG} + ;; + *) + echo "ERROR: Unknown arg ${arg}" + usage + ;; + esac +done +shift $((OPTIND-1)) + +if [ -z "${r}" ] || [ -z "${b}" ] || [ -z "${o}" ] || [ -z "${n}" ] ; then + echo "ERROR: Missing an argument!" + usage +fi + +#if [ "$(git status --short)" != "" ] ; then +# echo "You have uncommitted changes!" +# exit 1 +#fi + +create_release_branch="${c}" +release_branch="${r}" +branch="${b}" +old_version="${o}" +new_version="${n}" + +root="${PWD}" + +echo "old_version=${old_version}" +echo "new_version=${new_version}" +echo "branch=${branch}" +echo "release_branch=${release_branch}" +if [ -n "${create_release_branch}" ] ; then + echo "Creating release branch." +else + echo "NOT creating release branch." +fi + +exit + +function fail() { + git submodule foreach git reset --hard origin/${branch} + git submodule foreach git checkout ${branch} + if [ -n "${create_release_branch}" ] ; then + git submodule foreach git branch -d ${release_branch} + fi + git submodule foreach git tag -d ${new_version} + + git checkout ${branch} + git reset --hard origin/${branch} + git branch -d ${release_branch} + git tag -d ${new_version} + + echo -e "\nERROR: Failed to release version ${new_version}" + exit 1 +} + +# create release branch +if [ -n "${create_release_branch}" ] ; then + if ! git branch ${release_branch} ${branch} ; then + fail + fi + if ! git submodule foreach git branch ${release_branch} ${branch} ; then + fail + fi +fi + +# checkout release branch +if ! git checkout ${release_branch} ; then + fail +fi +if ! git submodule foreach git checkout ${release_branch} ; then + fail +fi + +# bump version +if ! ./setVersion.sh ${old_version} ${new_version} ; then + fail +fi + +# show status +if ! git status --short ; then + fail +fi +if ! git submodule foreach git status --short ; then + fail +fi + +echo "Do you want to carry on?" +read + +if ! git submodule foreach git add . ; then + fail +fi +if ! git submodule foreach git commit -m "[Project] bumped version from ${old_version} to ${new_version}" ; then + fail +fi +if ! git submodule foreach git tag ${new_version} ; then + fail +fi + +if ! git submodule sync ; then + fail +fi +if ! git add . ; then + fail +fi +if ! git commit -m "[Project] bumped version from ${old_version} to ${new_version}" ; then + fail +fi +if ! git tag ${new_version} ; then + fail +fi + +git submodule foreach git checkout ${branch} +if [ -n "${create_release_branch}" ] ; then + git submodule foreach git branch -d ${release_branch} +fi +git checkout ${branch} +if [ -n "${create_release_branch}" ] ; then + git branch -d ${release_branch} +fi + +echo -e "\nINFO: Released version ${new_version}" + +exit 0 diff --git a/setVersion.sh b/setVersion.sh index 952bc610d..d110c86f6 100755 --- a/setVersion.sh +++ b/setVersion.sh @@ -20,7 +20,7 @@ new_version="$2" root="${PWD}" function fail() { - echo "ERROR: Failed to set version of $1" + echo -e "\nERROR: Failed to set version of $1" exit 1 } @@ -78,3 +78,7 @@ cd "${root}" if ! sed --in-place "s/${old_version}/${new_version}/" li.strolch.dev/createBundle.sh 2>/dev/null ; then fail "${root}/li.strolch.dev/createBundle.sh" fi + +echo -e "\nINFO: Bumped version from ${old_version} to ${new_version}" + +exit 0 \ No newline at end of file