[Project] fixing release.sh script

This commit is contained in:
Robert von Burg 2014-09-22 20:55:32 +02:00
parent be985afbac
commit 7b84ab18f9
2 changed files with 23 additions and 3 deletions

View File

@ -43,6 +43,10 @@ if [ "$(git status --short)" != "" ] ; then
exit 1 exit 1
fi fi
declare SCRIPT_NAME="${0##*/}"
declare SCRIPT_DIR="$(cd ${0%/*} ; pwd)"
create_release_branch="${c}" create_release_branch="${c}"
release_branch="${r}" release_branch="${r}"
branch="${b}" branch="${b}"
@ -50,8 +54,10 @@ old_version="${o}"
new_version="${n}" new_version="${n}"
push="${p}" push="${p}"
root="${PWD}" root="$(cd ${SCRIPT_DIR}/.. ; pwd)"
echo "root=${root}"
echo "old_version=${old_version}" echo "old_version=${old_version}"
echo "new_version=${new_version}" echo "new_version=${new_version}"
echo "branch=${branch}" echo "branch=${branch}"
@ -87,6 +93,7 @@ function fail() {
exit 1 exit 1
} }
# create release branch # create release branch
if [ -n "${create_release_branch}" ] ; then if [ -n "${create_release_branch}" ] ; then
if ! git branch ${release_branch} ${branch} ; then if ! git branch ${release_branch} ${branch} ; then
@ -97,6 +104,7 @@ if [ -n "${create_release_branch}" ] ; then
fi fi
fi fi
# checkout release branch # checkout release branch
if ! git checkout ${release_branch} ; then if ! git checkout ${release_branch} ; then
fail fail
@ -105,11 +113,13 @@ if ! git submodule foreach git checkout ${release_branch} ; then
fail fail
fi fi
# bump version # bump version
if ! ./setVersion.sh ${old_version} ${new_version} ; then if ! "${root}/li.strolch.dev/setVersion.sh" ${old_version} ${new_version} ; then
fail fail
fi fi
# show status # show status
if ! git status --short ; then if ! git status --short ; then
fail fail
@ -118,6 +128,7 @@ if ! git submodule foreach git status --short ; then
fail fail
fi fi
# commit and tag submodules # commit and tag submodules
if ! git submodule foreach git add . ; then if ! git submodule foreach git add . ; then
fail fail
@ -129,6 +140,7 @@ if ! git submodule foreach git tag ${new_version} ; then
fail fail
fi fi
# commit and tag including ref to submodules # commit and tag including ref to submodules
if ! git submodule sync ; then if ! git submodule sync ; then
fail fail
@ -143,6 +155,7 @@ if ! git tag ${new_version} ; then
fail fail
fi fi
# update local working directory to original branch # update local working directory to original branch
if ! git submodule foreach git checkout ${branch} ; then if ! git submodule foreach git checkout ${branch} ; then
fail fail
@ -164,12 +177,14 @@ if ! git submodule update ; then
fail fail
fi fi
# push to origin # push to origin
if [ -n "${push}" ] ; then if [ -n "${push}" ] ; then
git push origin ${new_version} git push origin ${new_version}
git submodule foreach git push origin ${new_version} git submodule foreach git push origin ${new_version}
fi fi
echo -e "\nINFO: Released version ${new_version}" echo -e "\nINFO: Released version ${new_version}"
exit 0 exit 0

View File

@ -17,7 +17,9 @@ fi
old_version="$1" old_version="$1"
new_version="$2" new_version="$2"
root="${PWD}" declare SCRIPT_NAME="${0##*/}"
declare SCRIPT_DIR="$(cd ${0%/*} ; pwd)"
root="${SCRIPT_DIR}"
function fail() { function fail() {
echo -e "\nERROR: Failed to set version of $1" echo -e "\nERROR: Failed to set version of $1"
@ -60,6 +62,7 @@ for project in li.* ; do
fi fi
done done
cd "${root}" cd "${root}"
for project in ch.* ; do for project in ch.* ; do
cd "${root}/${project}" cd "${root}/${project}"
@ -74,11 +77,13 @@ for project in ch.* ; do
fi fi
done done
cd "${root}" cd "${root}"
if ! sed --in-place "s/${old_version}/${new_version}/" li.strolch.dev/createBundle.sh 2>/dev/null ; then 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" fail "${root}/li.strolch.dev/createBundle.sh"
fi fi
echo -e "\nINFO: Bumped version from ${old_version} to ${new_version}" echo -e "\nINFO: Bumped version from ${old_version} to ${new_version}"
exit 0 exit 0