diff --git a/setversion.sh b/setversion.sh index 0115e0bd7..fa1d7ba76 100755 --- a/setversion.sh +++ b/setversion.sh @@ -1,29 +1,37 @@ #!/bin/bash -if [ -z "$1" ] -then -cat << EOF + +if [ -z "$1" ]; then + cat <&2 + exit 1 fi set -Eeuo pipefail +# Set the release version mvn versions:set -DnewVersion="$1" -if [[ "$1" == *SNAPSHOT ]] -then - echo "This is a SNAPSHOT"; - git commit -am "Bump version to $1 [skip ci]" -else - echo "This is a Release"; - git commit -am "Release version $1" - git tag "$1" -fi +# Commit and tag the release version +echo "This is a Release" +git commit -am "Release version $1" +git tag "$1" + +# Set the new version to SNAPSHOT (e.g., if input is 8.1.4, set version to 8.1.4-SNAPSHOT) +SNAPSHOT_VERSION="${1}-SNAPSHOT" +mvn versions:set -DnewVersion="$SNAPSHOT_VERSION" + +# Commit the SNAPSHOT version +git commit -am "Bump version to $SNAPSHOT_VERSION [skip ci]"