-
Notifications
You must be signed in to change notification settings - Fork 15
/
release.sh
executable file
·42 lines (33 loc) · 1.12 KB
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
set -e # Exit the script if any command fails
if [ -z "$1" ]; then
echo "Please provide version that should be released and the next snapshot version. Example: ./release.sh 0.1.0 0.2.0-SNAPSHOT"
exit 1
fi
if [ -z "$2" ]; then
echo "Please provide version that should be released and the next snapshot version. Example: ./release.sh 0.1.0 0.2.0-SNAPSHOT"
exit 1
fi
if ! [[ "$1" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "The release version must be in the format A.B.C. Example: 0.1.0"
exit 1
fi
if ! [[ "$2" =~ ^[0-9]+\.[0-9]+\.[0-9]+-SNAPSHOT$ ]]; then
echo "The next snapshot version must be in the format A.B.C-SNAPSHOT. Example: 0.2.0-SNAPSHOT"
exit 1
fi
NEW_VERSION="$1"
NEXT_VERSION="$2"
export $(grep -v '^#' .env | xargs)
./mvnw clean
echo "Releasing version $NEW_VERSION"
./mvnw versions:set -DnewVersion=$NEW_VERSION
./mvnw clean verify
git commit -am "Version $NEW_VERSION"
git push
./mvnw -Ppublication deploy -DskipTests
./mvnw -Ppublication jreleaser:full-release
echo "Setting version to $NEXT_VERSION"
./mvnw versions:set -DnewVersion=$NEXT_VERSION
git commit -am "Version $NEXT_VERSION"
git push