Skip to content

Commit 67ce1dd

Browse files
committed
added release script
1 parent 5c6e650 commit 67ce1dd

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

release.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
# Fetch the current version from the POM
4+
MVN_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
5+
echo "Current Maven version: $MVN_VERSION"
6+
7+
# Release version
8+
RELEASE_VERSION=${MVN_VERSION%-SNAPSHOT}
9+
echo "Releasing version: $RELEASE_VERSION"
10+
11+
# Set the new release version and tag it in Git
12+
mvn versions:set -DnewVersion="$RELEASE_VERSION" -DgenerateBackupPoms=false
13+
# Deploy the project
14+
mvn clean source:jar javadoc:jar deploy -DskipTests -Prelease
15+
# update git
16+
git add '**/pom.xml'
17+
git commit -am "$RELEASE_VERSION release"
18+
git tag -a "v$RELEASE_VERSION" -m "v$RELEASE_VERSION release"
19+
20+
# Extract the current version number components
21+
IFS='.' read -r -a VERSION_PARTS <<< "$MVN_VERSION"
22+
MAJOR="${VERSION_PARTS[0]}"
23+
MINOR="${VERSION_PARTS[1]}"
24+
PATCH="${VERSION_PARTS[2]}"
25+
# Increment the patch version for the next snapshot
26+
PATCH=$((PATCH + 1))
27+
NEXT_VERSION="$MAJOR.$MINOR.$PATCH-SNAPSHOT"
28+
echo "Next development version: $NEXT_VERSION"
29+
30+
# Set the next snapshot version and commit it in Git
31+
mvn versions:set -DnewVersion="$NEXT_VERSION" -DgenerateBackupPoms=false
32+
git add '**/pom.xml'
33+
git commit -am "Next development version $NEXT_VERSION"
34+
35+
git push
36+
git push --tags

0 commit comments

Comments
 (0)