Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

Commit a724cb9

Browse files
authored
Merge pull request #180 from scalecube/travis-ci-cd
ci-cd using Travis CI
2 parents 57ba535 + 1e89e0b commit a724cb9

File tree

2 files changed

+34
-3
lines changed

2 files changed

+34
-3
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ deploy:
2020
script:
2121
- "./src/main/scripts/cd/release.sh"
2222
on:
23+
tags: true
2324
branch: master

src/main/scripts/cd/release.sh

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,45 @@ commit_to_develop() {
1010
git fetch
1111
git branch -r
1212
git checkout -B develop
13-
git rebase master
13+
git rebase $TRAVIS_BRANCH
1414
git commit --amend -m "++++ Prepare for next development iteration build: $TRAVIS_BUILD_NUMBER ++++"
1515
git push origin develop
1616
}
1717

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
1946

2047
mvn clean
21-
commit_to_develop
48+
49+
if [ -z "$NEW_RC_VERSION" ]; then
50+
commit_to_develop
51+
fi
2252

2353
# extends release.sh
2454
for script_file in $RELEASE_EXEC_FILES; do

0 commit comments

Comments
 (0)