[Project] setVersion.sh can now also commit
This commit is contained in:
parent
ce7cd45974
commit
6ae5512db3
|
@ -80,20 +80,20 @@ push="${p}"
|
|||
|
||||
|
||||
# log what we are doing
|
||||
echo "root=${root}"
|
||||
echo "old_version=${old_version}"
|
||||
echo "new_version=${new_version}"
|
||||
echo "branch=${branch}"
|
||||
echo "release_branch=${release_branch}"
|
||||
echo "INFO: root=${root}"
|
||||
echo "INFO: old_version=${old_version}"
|
||||
echo "INFO: new_version=${new_version}"
|
||||
echo "INFO: branch=${branch}"
|
||||
echo "INFO: release_branch=${release_branch}"
|
||||
if [ -n "${create_release_branch}" ] ; then
|
||||
echo "Creating release branch."
|
||||
echo "INFO: Creating release branch."
|
||||
else
|
||||
echo "NOT creating release branch."
|
||||
echo "INFO: NOT creating release branch."
|
||||
fi
|
||||
if [ -n "${push}" ] ; then
|
||||
echo "Pushing to origin."
|
||||
echo "INFO: Pushing to origin."
|
||||
else
|
||||
echo "NOT pushing to origin."
|
||||
echo "INFO: NOT pushing to origin."
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
@ -192,7 +192,7 @@ fi
|
|||
|
||||
|
||||
# build with new version
|
||||
echo "Building new version ${new_version}..."
|
||||
echo -e "\nINFO: Building new version ${new_version}..."
|
||||
if ! build ; then
|
||||
fail
|
||||
fi
|
||||
|
@ -220,7 +220,7 @@ echo -e "\nINFO: Committing and tagging..."
|
|||
if ! git add . ; then
|
||||
fail
|
||||
fi
|
||||
if ! git commit -m "[Project] bumped version from ${old_version} to ${new_version}" ; then
|
||||
if ! git commit -m "[Project] Bumped version from ${old_version} to ${new_version}" ; then
|
||||
fail
|
||||
fi
|
||||
if ! git tag ${new_version} ; then
|
||||
|
@ -229,7 +229,7 @@ fi
|
|||
|
||||
|
||||
# create bundle for new version
|
||||
echo "Creating bundle for version ${new_version}..."
|
||||
echo -e "\nINFO: Creating bundle for version ${new_version}..."
|
||||
if ! createBundle ; then
|
||||
fail
|
||||
fi
|
||||
|
|
|
@ -1,15 +1,45 @@
|
|||
#!/bin/bash
|
||||
if [ "$#" != "2" ] ; then
|
||||
echo "ERROR: Wrong arguments!"
|
||||
echo "Usage: $0 <old_version> <new_version>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! $(which xmlstarlet) ] ; then
|
||||
echo "ERROR: xmlstarlet is missing!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
function usage() {
|
||||
echo "Usage: $0 [-c] [-o <old_version>] [-n <new_version>]" 1>&2;
|
||||
echo " -c commit"
|
||||
echo " -o <old_version> old version e.g. 1.0.0-SNAPSHOT"
|
||||
echo " -n <new_version> new version e.g. 1.0.0-RC3"
|
||||
echo ""
|
||||
exit 1;
|
||||
}
|
||||
|
||||
# get arguments
|
||||
while getopts ":b:o:n:r:cp" arg; do
|
||||
case "${arg}" in
|
||||
c)
|
||||
c="true"
|
||||
;;
|
||||
o)
|
||||
o=${OPTARG}
|
||||
;;
|
||||
n)
|
||||
n=${OPTARG}
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: Unknown arg ${arg}"
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
# validate arguments
|
||||
if [ -z "${o}" ] || [ -z "${n}" ] ; then
|
||||
echo "ERROR: Missing an argument!"
|
||||
usage
|
||||
fi
|
||||
|
||||
#if ! mvn -f pom.xml versions:set -DnewVersion="${1}" -DallowSnapshots=true -DgenerateBackupPoms=false ; then
|
||||
# echo "ERROR: Failed to change version in root!"
|
||||
# exit 1
|
||||
|
@ -19,8 +49,9 @@ fi
|
|||
# exit 1
|
||||
#fi
|
||||
|
||||
old_version="$1"
|
||||
new_version="$2"
|
||||
old_version="${o}"
|
||||
new_version="${n}"
|
||||
commit="${c}"
|
||||
|
||||
declare SCRIPT_NAME="${0##*/}"
|
||||
declare SCRIPT_DIR="$(cd ${0%/*} ; pwd)"
|
||||
|
@ -93,6 +124,21 @@ if ! sed -i.bck "s/${old_version}/${new_version}/" "${create_script}" 2>/dev/nul
|
|||
fi
|
||||
rm -f "${create_script}.bck"
|
||||
|
||||
|
||||
# Commit new version
|
||||
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}"
|
||||
git submodule foreach git push origin develop
|
||||
git add .
|
||||
git commit -m "[Project] Bumped version from ${old_version} to ${new_version}"
|
||||
git push origin develop
|
||||
else
|
||||
echo "INFO: NOT committing new version"
|
||||
fi
|
||||
|
||||
|
||||
echo -e "\nINFO: Bumped version from ${old_version} to ${new_version}"
|
||||
|
||||
exit 0
|
||||
|
|
Loading…
Reference in New Issue