Skip to content

Instantly share code, notes, and snippets.

@voor
Last active December 10, 2015 16:09
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 voor/f460d31b1207a657c4aa to your computer and use it in GitHub Desktop.
Save voor/f460d31b1207a657c4aa to your computer and use it in GitHub Desktop.
#!/bin/sh
# We run the first part twice, since the first time it's going to output a bunch of maven log stuff.
mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -v '\[' | grep -v 'Downloading:' | sed s/-SNAPSHOT//
export VERSION=`mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -v '\[' | grep -v 'Downloading:' | sed s/-SNAPSHOT//`
git checkout master
mvn release:update-versions -DdevelopmentVersion=$VERSION-development-SNAPSHOT # The version in master should already be something similar, $VERSION-SNAPSHOT
git commit -a -m "Updated development version to $VERSION-development-SNAPSHOT"
git checkout development
git merge master -m "Merging development version into development."
git checkout -b $VERSION-SNAPSHOT-version
git push --set-upstream origin $VERSION-SNAPSHOT-version # Since development is a protected branch you need to log into github and issue a pull request for this.
git checkout master
git branch -D $VERSION-SNAPSHOT-version
git revert `git log --format="%H" -n 1` --no-edit # This reverts the commit in master so that it won't see it during a merge from development
git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment