Created
March 30, 2010 09:52
-
-
Save dgageot/348965 to your computer and use it in GitHub Desktop.
This file contains 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/sh | |
PWD=`pwd` | |
CURRENT=`grep "<version>" -i pom.xml --max-count 1 | sed -e "s/.*<version>\(.*\)<\/version>/\1/" | sed -e "s/-SNAPSHOT//"` | |
MAJOR_VERSION=`echo $CURRENT | sed -e "s/\([0-9]*\.[0-9]*\.\)\([0-9]*\)/\1/"` | |
MINOR_VERSION=`echo $CURRENT | sed -e "s/\([0-9]*\.[0-9]*\.\)\([0-9]*\)/\2/"` | |
NEXT=$MAJOR_VERSION`expr $MINOR_VERSION + 1`-SNAPSHOT | |
TAG=VERSION$CURRENT | |
echo "=== RELEASING $CURRENT ===" | |
find . -name "*.xml" | xargs perl -pi -e "s/${CURRENT}-SNAPSHOT/${NEXT}/g" | |
git add . | |
git stash save "Preparing $NEXT" | |
find . -name "*.xml" | xargs perl -pi -e "s/$CURRENT-SNAPSHOT/$CURRENT/g" | |
git commit -a -m "$CURRENT" | |
git tag -f "$TAG" | |
echo "=== BUILDING $CURRENT ===" | |
mvn clean install -PfullPackage | |
if [ "$?" -ne 0 ] | |
then | |
echo "Maven build failed. Aborting." | |
git reset --hard HEAD~1 | |
git tag -d "$TAG" | |
exit | |
fi | |
echo "=== PUSHING $NEXT ===" | |
git stash pop --quiet | |
git co --theirs * | |
git commit -a -m "$NEXT" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment