#
# this script is run after maven for maven build jobs
+function validateSettings {
+ VERSION=$(mvn -B -N help:evaluate -Dexpression=project.version 2>/dev/null| grep -v "^\[" | grep -v "^D" )
+ if [[ -z "${VERSION}" ]]; then
+ echo "ERROR: Cannot get version from maven using 'mvn -B -N help:evaluate -Dexpression=project.version'"
+ mvn -B -N help:evaluate -Dexpression=project.version
+ exit 1
+ fi
+}
+
#############
# MAIN
#############
cd $WORKSPACE
+validateSettings
+
export
set -e # fail on error
set -x # echo commands executed
+# push back to git repo if build from master or hotfix/
+if [[ "$GIT_BRANCH_NAME" = "master" ]] || [[ "${GIT_BRANCH_NAME:0:7}" = "hotfix/" ]]; then
+ # ~ and : are not valid in git tags, replace them:
+ TAG=$(echo $VERSION | tr '~' '_' | tr ':' ',')
+ git tag $TAG
+ git push origin $TAG
+ figlet "Tagged."
+fi
+
# push back integration branch if we merged a feature branch
if [[ ${GIT_BRANCH_NAME:0:8} = "feature/" ]] || [[ ${GIT_BRANCH_NAME:0:7} = "bugfix/" ]]; then
if [[ "$BUILD_TRIGGERS" = *"merge"* ]]; then