forked from Merck/sonar-r-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·42 lines (32 loc) · 1.35 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
#!/usr/bin/env bash
set -euo pipefail
echo "=====> Setting release version"
git checkout master
# set release version in POM
./mvnw build-helper:parse-version \
versions:set '-DnewVersion=${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}' \
versions:commit
# read version back into bash variable
RELEASE_VERSION=$(./mvnw help:evaluate -N -Dexpression=project.version|grep -v '\[')
echo "=====> Current release: ${RELEASE_VERSION}"
# release branch
git checkout -b release/v${RELEASE_VERSION}
#
git commit -a -m "Update release ${RELEASE_VERSION} in POM"
# release tag on the same commit
git tag "${RELEASE_VERSION}"
git push origin release/v${RELEASE_VERSION} --tags -n
echo "=====> Setting new development version"
git checkout master
# set next SNAPSHOT in POM
./mvnw build-helper:parse-version \
versions:set '-DnewVersion=${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.nextIncrementalVersion}-SNAPSHOT' \
versions:commit
# read version back into bash variable
DEVELOPMENT_VERSION=$(./mvnw help:evaluate -N -Dexpression=project.version|grep -v '\[')
echo "=====> New development: ${DEVELOPMENT_VERSION}"
#
git commit -a -m "Set new development version to ${DEVELOPMENT_VERSION}"
#
git push -n
echo "=====> Only dry run, use 'git push origin --all && git push origin --tags' to push"