forked from jmxtrans/jmxtrans
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtravis-script.sh
executable file
·48 lines (41 loc) · 1.79 KB
/
travis-script.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
43
44
45
46
47
48
#!/bin/bash
set -ev
MVN_SETTINGS=${HOME}/travis/settings.xml
if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
if [ "$TRAVIS_BRANCH" == "master" ]; then
echo "Building master"
mvn deploy --settings ${MVN_SETTINGS} -B -V -PwithMutationTests,gpg,rpm,deb
elif [ "$TRAVIS_BRANCH" == "release" ]; then
if [[ `git log --format=%B -n 1` == *"[maven-release-plugin]"* ]]; then
echo "Do not release commits created by maven release plugin"
else
echo "Building release"
# decrypt SSH key so we can push release to GitHub
gpg --homedir ${HOME}/travis \
--output ${HOME}/.ssh/id_rsa \
--passphrase ${GPG_PASSPHRASE} \
--decrypt ${HOME}/travis/id_rsa.gpg
chmod 600 ${HOME}/.ssh/id_rsa
# configure our git identity
git config --global user.email "[email protected]"
git config --global user.name "JmxTrans travis build"
# travis checkout the commit as detatched head (which is normally what we
# want) but maven release plugin does not like working in detatched head
# mode. This might be a problem if other commits have already been pushed
# to the release branch, but in that case we will have problem anyway.
git checkout release
mvn release:prepare --settings ${MVN_SETTINGS} -B -V -Pgpg,rpm,deb -Darguments="--settings ${MVN_SETTINGS}"
mvn release:perform --settings ${MVN_SETTINGS} -B -V -Pgpg,rpm,deb -Darguments="--settings ${MVN_SETTINGS}"
git fetch
git checkout -b master origin/master
git merge release
git push origin master
fi
else
echo "Building feature branch"
mvn verify --settings ${MVN_SETTINGS} -B -V -PwithMutationTests,rpm,deb
fi
else
echo "Building pull request"
mvn verify --settings ${MVN_SETTINGS} -B -V -PwithMutationTests
fi