Skip to content

Commit 956963d

Browse files
committed
Add script for bumping version for releases
1 parent 3a45d71 commit 956963d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

bump.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
function die_with() { echo "$*" >&2; exit 1; }
4+
5+
echo "Getting current version from pom.xml"
6+
CURRENT_VERSION="`sed -n 's|.*<version>\(.*\)</version>.*|\1|p' pom.xml | awk '{ print $1; exit }'`" && echo "Current version from pom.xml: $CURRENT_VERSION"
7+
8+
read -p "New version: " NEW_VERSION || die_with "Prompt for new version failed"
9+
10+
if ! echo $NEW_VERSION | grep -i -- '-SNAPSHOT' >/dev/null; then echo "WARNING: changing to a release version!"; fi
11+
12+
echo "Updating the project version in build.gradle, pom.xml and README.md to $NEW_VERSION"
13+
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!"
14+
chmod 644 build.gradle pom.xml README.md

0 commit comments

Comments
 (0)