-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script for bumping version for releases
- Loading branch information
1 parent
eab35f1
commit 22d2401
Showing
1 changed file
with
14 additions
and
0 deletions.
There are no files selected for viewing
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
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 |