diff --git a/Jenkinsfile b/Jenkinsfile index 33ccd3b..bc474e1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -150,8 +150,33 @@ pipeline { { if(sh(returnStdout: true, script: "git tag --points-at HEAD").trim().isEmpty()) { - echo "master push/merge must have an explicit tag release number, stopping pipeline" - currentBuild.getRawBuild().getExecutor().doStop() + BUMPED_VERSION = sh(script: """#!/bin/sh - + |. ~/TOOLS_ENV/bin/activate + |exec python - << '__EOWRAPPER__' + | + |from pygitversionhelper import gitversionhelper + |import re + | + |lastcommit=gitversionhelper.commit.getLast(same_branch=True) + |msg=gitversionhelper.commit.getMessage(lastcommit) + | + |_match=re.search(r"\\s*(?:#)?\\s*(?<=new-tag:)(?:\\s*)(?P\\S*)",msg) + |print(_match.group("TAG"),end="") + | + |__EOWRAPPER__ + """.stripMargin(), + returnStdout: true).trim() + if(BUMPED_VERSION.isEmpty()) + { + echo "master push/merge must have an explicit tag release number, stopping pipeline" + currentBuild.getRawBuild().getExecutor().doStop() + } + else + { + echo "new-tag requested in commit message: $BUMPED_VERSION" + sh("git tag -a $BUMPED_VERSION") + sh("git push origin master --tags") + } } }