Created
March 24, 2016 23:51
-
-
Save dwelch2344/49e3c38a539485785d9d to your computer and use it in GitHub Desktop.
This jenkins script looks for a ENV VAR (parameterized via Build Params) defined as *RELEASE*, which if != "No" will Swap the traditional X.Y.Z[-IDENTIFIER] version for X.Y.Zb[BUILD_NUMBER][IDENTIFIER] (with IDENTIFIER being determined based on whether RELEASE is Snapshot or Release)
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 | |
if [[ "$RELEASE" != "No" ]]; then | |
if [[ "$RELEASE" == "Release" ]]; then | |
BUILD_SUFFIX=".RELEASE" | |
elif [[ "$RELEASE" == "Snapshot" ]]; then | |
BUILD_SUFFIX="-SNAPSHOT" | |
fi | |
echo "Swapping version for X.X.${BUILD_NUMBER}${BUILD_SUFFIX}" | |
sed -i -e "1,/<version>\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*<\/version>/s/<version>\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*<\/version>/<version>\1.\2.\3b${BUILD_NUMBER}${BUILD_SUFFIX}<\/version>/" pom.xml | |
else | |
echo "Not swapping version" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment