[Project] creating release script

This commit is contained in:
Robert von Burg 2014-09-20 15:02:47 +02:00
parent 010e542ca9
commit 9ffa593a0d
1 changed files with 17 additions and 4 deletions

View File

@ -1,15 +1,18 @@
#!/bin/bash #!/bin/bash
function usage() { function usage() {
echo "Usage: $0 [-c] [-r <release_branch>] [-b <branch>] [-o <old_version>] [-n <new_version>]" 1>&2; echo "Usage: $0 [-c] [-p] [-r <release_branch>] [-b <branch>] [-o <old_version>] [-n <new_version>]" 1>&2;
exit 1; exit 1;
} }
while getopts ":b:o:n:r:c" arg; do while getopts ":b:o:n:r:cp" arg; do
case "${arg}" in case "${arg}" in
c) c)
c="true" c="true"
;; ;;
p)
p="true"
;;
r) r)
r=${OPTARG} r=${OPTARG}
;; ;;
@ -45,6 +48,7 @@ release_branch="${r}"
branch="${b}" branch="${b}"
old_version="${o}" old_version="${o}"
new_version="${n}" new_version="${n}"
push="${p}"
root="${PWD}" root="${PWD}"
@ -57,7 +61,13 @@ if [ -n "${create_release_branch}" ] ; then
else else
echo "NOT creating release branch." echo "NOT creating release branch."
fi fi
if [ -n "${push}" ] ; then
echo "Pushing to origin."
else
echo "NOT pusing to origin."
fi
exit
function fail() { function fail() {
git submodule foreach git reset --hard origin/${branch} git submodule foreach git reset --hard origin/${branch}
@ -134,6 +144,7 @@ if ! git tag ${new_version} ; then
fail fail
fi fi
# 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
fi fi
@ -150,10 +161,12 @@ if [ -n "${create_release_branch}" ] ; then
fail fail
fi fi
fi fi
if ! git submodule update ; then
git submodule update fail
fi
git push origin ${new_version} git push origin ${new_version}
git submodule foreach git push origin ${new_version}
echo -e "\nINFO: Released version ${new_version}" echo -e "\nINFO: Released version ${new_version}"