@@ -10,15 +10,45 @@ commit_to_develop() {
10
10
git fetch
11
11
git branch -r
12
12
git checkout -B develop
13
- git rebase master
13
+ git rebase $TRAVIS_BRANCH
14
14
git commit --amend -m " ++++ Prepare for next development iteration build: $TRAVIS_BUILD_NUMBER ++++"
15
15
git push origin develop
16
16
}
17
17
18
- mvn -P release -Darguments=-DskipTests release:prepare release:perform -DautoVersionSubmodules=true -DscmCommentPrefix=" $TRAVIS_COMMIT_MESSAGE [skip ci] " -B -V -s travis-settings.xml
18
+ function check_next_version {
19
+ export NEXT_VERSION=$( echo $TRAVIS_COMMIT_MESSAGE | grep -E -o ' [0-9]+\.[0-9]+\.[0-9]+-SNAPSHOT' )
20
+ if [ -n " $NEXT_VERSION " ] ; then
21
+ export MVN_NEXT_VERSION=-DdevelopmentVersion=$NEXT_VERSION
22
+ fi
23
+ }
24
+
25
+ function check_tag_for_rc {
26
+ export VERSION=$( mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
27
+ if [ -n " $TRAVIS_TAG " ] ; then
28
+ RC_VER=$( echo $TRAVIS_TAG | grep -E -o ' RC-?[0-9]+' )
29
+ RC_PREPARE=$( echo $TRAVIS_TAG | grep -o -i ' prepare' )
30
+ if [ -n " $RC_VER " -a -n " $RC_PREPARE " ] ; then
31
+ export NEW_RC_VERSION=$( echo $VERSION | sed " s/SNAPSHOT/$RC_VER /g" )
32
+ echo Release candidate: $NEW_RC_VERSION
33
+ echo * -* -* -* -* -* -* -* -* -* -* -*
34
+ export MVN_RELEASE_VERSION=-DreleaseVersion=$NEW_RC_VERSION
35
+ if [ -n " $MVN_NEXT_VERSION " ] ; then
36
+ export MVN_NEXT_VERSION=-DdevelopmentVersion=$VERSION ;
37
+ fi
38
+ fi
39
+ fi
40
+ }
41
+
42
+ check_next_version
43
+ check_tag_for_rc
44
+
45
+ mvn -P release -Darguments=-DskipTests release:prepare release:perform $MVN_RELEASE_VERSION $MVN_NEXT_VERSION -DautoVersionSubmodules=true -DscmCommentPrefix=" $TRAVIS_COMMIT_MESSAGE [skip ci] " -B -V -s travis-settings.xml
19
46
20
47
mvn clean
21
- commit_to_develop
48
+
49
+ if [ -z " $NEW_RC_VERSION " ]; then
50
+ commit_to_develop
51
+ fi
22
52
23
53
# extends release.sh
24
54
for script_file in $RELEASE_EXEC_FILES ; do
0 commit comments