Last active
August 29, 2015 14:12
-
-
Save le6o/1ea9bf2cfebf9ec5c280 to your computer and use it in GitHub Desktop.
Grab version number from last merged GitHub pull request of a gitflow release branch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TAG=$(git log --format=%s --merges -n 1 | cut -d '/' -f 3) | |
if ! [[ $TAG =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
return 1 | |
fi | |
echo "TAG = $TAG" > properties | |
# Used as a jenkins build step to grab the version number from the last | |
# merged GitHub pull request commit message. | |
# Assumes you are building on master and that you've just merged a gitflow | |
# release branch of the form, release/1.2.3 via GitHub pull request. | |
# Requires the EnvInject Plugin to read variables from the properties file. | |
# The variable $TAG can then be used with the git publisher plugin to push the tag. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment