Skip to content

Instantly share code, notes, and snippets.

@jeanlaurent
Created September 6, 2011 16:34
Show Gist options
  • Save jeanlaurent/1198081 to your computer and use it in GitHub Desktop.
Save jeanlaurent/1198081 to your computer and use it in GitHub Desktop.
Help automate the release of maven artifacts
#!/bin/sh
function checkError {
if [ "$?" -ne "0" ]; then
echo ""
echo "ECHEC dans $1"
echo ""
exit 1
fi
}
function gitCommitIfModifications {
GIT_STATUS=`git status --porcelain | grep M`
if [ "$GIT_STATUS" == "" ]; then
echo ""
echo "$2"
echo ""
else
git add pom.xml
git ci -m'$1'
fi
}
# UPDATING PARENT POM
mvn versions:update-parent
checkError "Update parent"
gitCommitIfModifications "Updated parent pom" "Parent pom is already using latest version."
# UPDATING DEPENDENCIES
mvn versions:use-latest-versions -Dincludes=com.urbandive
checkError "Update dependencies"
gitCommitIfModifications "Updated pom to latest version" "No new dependencies."
echo "Do you want to release geoentity-parent-conf (y/n)"
read yesno
if [ "$yesno" == "y" ]; then
mvn release:clean release:prepare
checkError
mvn release:perform
checkError
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment