From cacfae600e04d9b61f38e545a5a8ac96d4efecb0 Mon Sep 17 00:00:00 2001 From: Pascal Giannakakis Date: Mon, 23 Jun 2014 19:57:45 +0200 Subject: [PATCH] - Re-adds tagging feature that was accidentally dropped --- maven_post_build_debian_wrapper.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/maven_post_build_debian_wrapper.sh b/maven_post_build_debian_wrapper.sh index 4d2dde8..c1e2244 100755 --- a/maven_post_build_debian_wrapper.sh +++ b/maven_post_build_debian_wrapper.sh @@ -7,16 +7,36 @@ # # 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 -- 2.39.5