Skip to content

Instantly share code, notes, and snippets.

@talios
Created March 21, 2014 21:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save talios/9696405 to your computer and use it in GitHub Desktop.
Save talios/9696405 to your computer and use it in GitHub Desktop.
Git command to wrap handling Apache Maven Releases with GitFlow
#!/bin/sh
if ! git diff-index --quiet HEAD --; then
echo "Git is dirty, clean up your mess!"
exit 1
fi
VERSION=`xml sel -N x="http://maven.apache.org/POM/4.0.0" -t -v "/x:project/x:version" pom.xml`
BASEVERSION=${VERSION%-SNAPSHOT}
ARTIFACTID=`xml sel -N x="http://maven.apache.org/POM/4.0.0" -t -v "/x:project/x:artifactId" pom.xml`
echo "Removing non-scm files..."
git clean -fdi
echo "Checking master branch for updates..."
git fetch origin master
git flow release start $BASEVERSION && mvn release:prepare release:perform -Psonatype && git flow release finish $BASEVERSION && git push && git push --tags && git push gerrit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment