File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change 1414 chmod 600 $HOME /.netrc
1515}
1616
17+ getVersion () {
18+ gradle properties -q | grep " version:" | grep -v " kotlin_version:" | awk ' {print $2}' | tr -d ' [:space:]'
19+ }
20+
21+ removeSnapshots () {
22+ sed -i ' s/-SNAPSHOT//' gradle.properties
23+ }
24+
25+ commitRelease () {
26+ local APP_VERSION=$( getVersion)
27+ git commit -a -m " Update version for release"
28+ git tag -a " v${APP_VERSION} " -m " Tag release version"
29+ }
30+
31+ bumpVersion () {
32+ echo " Bump version number"
33+ local APP_VERSION=$( getVersion | xargs)
34+ local SEMANTIC_REGEX=' ^([0-9]+)\.([0-9]+)(\.([0-9]+))?$'
35+ if [[ ${APP_VERSION} =~ ${SEMANTIC_REGEX} ]]; then
36+ if [[ ${BASH_REMATCH[4]} ]]; then
37+ nextVersion=$(( BASH_REMATCH[4 ] + 1 ))
38+ nextVersion=" ${BASH_REMATCH[1]} .${BASH_REMATCH[2]} .${nextVersion} -SNAPSHOT"
39+ else
40+ nextVersion=$(( BASH_REMATCH[2 ] + 1 ))
41+ nextVersion=" ${BASH_REMATCH[1]} .${nextVersion} -SNAPSHOT"
42+ fi
43+
44+ echo " Next version: ${nextVersion} "
45+ sed -i -E " s/^version(\s)?=.*/version=${nextVersion} /" gradle.properties
46+ else
47+ echo " No semantic version and therefore cannot publish to maven repository: '${APP_VERSION} '"
48+ fi
49+ }
50+
51+ commitNextVersion () {
52+ git commit -a -m " Update version for release"
53+ }
54+
1755if [ " ${TRAVIS_PULL_REQUEST} " = " false" ] && [ " ${TRAVIS_BRANCH} " = " master" ]; then
1856 if [ " ${RELEASE} " = " true" ]; then
1957 echo " Deploying release to Bintray"
2058 saveGitCredentials
59+ removeSnapshots
60+
2161 ./gradlew clean assemble && ./gradlew check --info && ./gradlew bintrayUpload -x check --info
62+
63+ commitRelease
64+ bumpVersion
65+ commitNextVersion
66+ git push --follow-tags
2267 else
2368 echo " Deploying snapshot"
2469 saveGitCredentials
You can’t perform that action at this time.
0 commit comments