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

View File

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