11#! /usr/bin/env bash
22set -e
33
4- increment_version_to_next_snapshot ()
5- # http://stackoverflow.com/a/8659330/5226815
6- {
7- declare -a part=( ${1// \. / } )
8- declare new
9- declare -i carry=1
10-
11- for (( CNTR= ${# part[@]} - 1 ; CNTR>= 0 ; CNTR-= 1 )) ; do
12- len=${# part[CNTR]}
13- new=$(( part[CNTR]+ carry))
14- [ ${# new} -gt $len ] && carry=1 || carry=0
15- [ $CNTR -gt 0 ] && part[CNTR]=${new: -len} || part[CNTR]=${new}
16- done
17- new=" ${part[*]} "
18- new_snapshot=" ${new// / .} -SNAPSHOT"
19- }
20-
214# update current version number to a TAG version if this is a tag build
225if [ ! -z " $TRAVIS_TAG " ]
236then
@@ -43,29 +26,3 @@ if [ ! -z "$TRAVIS" ]; then
4326 shred -v ~ /.gnupg/*
4427 rm -rf ~ /.gnupg
4528fi
46-
47- # increment version to the next snapshot version, commit and push to repository
48- if [ ! -z " $TRAVIS_TAG " ]
49- then
50- increment_version_to_next_snapshot $TRAVIS_TAG
51- echo " on a tag -> set pom.xml <version> to next SNAPSHOT $new_snapshot "
52- git checkout master
53- mvn --settings .travis/mvnsettings.xml org.codehaus.mojo:versions-maven-plugin:2.3:set -DnewVersion=$new_snapshot
54- mvn --settings .travis/mvnsettings.xml org.codehaus.mojo:versions-maven-plugin:2.3:commit
55- # Save some useful information
56- REPO=` git config remote.origin.url`
57- SSH_REPO=${REPO/ https: \/\/ github.com\/ / git@ github.com: }
58- git config user.name " Travis CI"
59- git config user.email
" [email protected] " 60- git add pom.xml
61- git commit -m " [Travis-CI] next snapshot version"
62-
63- # Get the deploy key by using Travis's stored variables to decrypt deploy_key.enc
64- openssl aes-256-cbc -K $encrypted_7a1322f4b03c_key -iv $encrypted_7a1322f4b03c_iv -in .travis/deploy_key.enc -out .travis/deploy_key -d
65- chmod 600 .travis/deploy_key
66- eval ` ssh-agent -s`
67- ssh-add .travis/deploy_key
68-
69- # Now that we're all set up, we can push.
70- git push $SSH_REPO master
71- fi
0 commit comments