Skip to content

Commit

Permalink
Add script for bumping version for releases
Browse files Browse the repository at this point in the history
  • Loading branch information
lukespragg committed Feb 11, 2015
1 parent eab35f1 commit 22d2401
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions bump.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

function die_with() { echo "$*" >&2; exit 1; }

echo "Getting current version from pom.xml"
CURRENT_VERSION="`sed -n 's|.*<version>\(.*\)</version>.*|\1|p' pom.xml | awk '{ print $1; exit }'`" && echo "Current version from pom.xml: $CURRENT_VERSION"

read -p "New version: " NEW_VERSION || die_with "Prompt for new version failed"

if ! echo $NEW_VERSION | grep -i -- '-SNAPSHOT' >/dev/null; then echo "WARNING: changing to a release version!"; fi

echo "Updating the project version in build.gradle, pom.xml and README.md to $NEW_VERSION"
sed -ri "s/"`echo $CURRENT_VERSION | sed 's/\./\\\\./g'`"/$NEW_VERSION/g" build.gradle pom.xml README.md || die_with "Failed to update the project version!"
chmod 644 build.gradle pom.xml README.md

0 comments on commit 22d2401

Please sign in to comment.