-
-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enforce release version only in setversion.sh and update commit messa…
…ges for versioning
- Loading branch information
Showing
1 changed file
with
26 additions
and
18 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 |
---|---|---|
@@ -1,29 +1,37 @@ | ||
#!/bin/bash | ||
if [ -z "$1" ] | ||
then | ||
cat << EOF | ||
|
||
if [ -z "$1" ]; then | ||
cat <<EOF | ||
This script is used to set the version of the project. | ||
It also commits the change and creates a tag if the version is not a SNAPSHOT. | ||
To create a new stable release of RESTHeart, for example 7.3.4: | ||
It only accepts release versions (not SNAPSHOT versions). | ||
To create a new stable release of RESTHeart, for example 8.2.0: | ||
$ ./setversion.sh 7.3.4 | ||
$ ./setversion.sh 7.3.5-SNAPSHOT | ||
$ git push && git push --tags | ||
$ ./setversion.sh 8.2.0 | ||
# This will automatically create a new release version and set the next version as a SNAPSHOT. | ||
EOF | ||
exit 1 | ||
exit 1 | ||
fi | ||
|
||
# Enforce release version only (do not allow "SNAPSHOT" in the version) | ||
if [[ "$1" == *SNAPSHOT* ]]; then | ||
echo "Error: SNAPSHOT versions are not allowed. Please provide a release version (e.g., 8.1.4)." >&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]" |