jenkins pipeline : 使用sh脚本自动打git tag
if [[ "${GIT_BRANCH}" == "xxx" ]]; then
TAG_VERSION="V"$(mvn -Dexec.executable='echo' -Dexec.args='${project.version}' --non-recursive exec:exec -q | sed 's/-SNAPSHOT//')
#如果没拉到分支先fetch 一下
# git fetch
git checkout
git tag "${TAG_VERSION}"
git push origin "${TAG_VERSION}"
fi