-
Notifications
You must be signed in to change notification settings - Fork 55
/
buildViaTravis.sh
executable file
·51 lines (46 loc) · 2.24 KB
/
buildViaTravis.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
49
50
51
#!/bin/bash
# This script will build the project.
# Evaluating a pull request
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
echo -e "Build Pull Request #$TRAVIS_PULL_REQUEST => Branch [$TRAVIS_BRANCH]"
./gradlew build
# Building a code commit, but not a release tag
elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_TAG" == "" ]; then
echo -e 'Build Branch with Snapshot => Branch ['$TRAVIS_BRANCH']'
./gradlew -Prelease.travisci=true -PbintrayUser="${bintrayUser}" -PbintrayKey="${bintrayKey}" -PsonatypeUsername="${sonatypeUsername}" -PsonatypePassword="${sonatypePassword}" build snapshot
# Building a release tag
elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_TAG" != "" ]; then
echo -e 'Build Branch for Release => Branch ['$TRAVIS_BRANCH'] Tag ['$TRAVIS_TAG']'
case "$TRAVIS_TAG" in
*-rc\.*)
./gradlew -Prelease.travisci=true -Prelease.useLastTag=true -PbintrayUser="${bintrayUser}" -PbintrayKey="${bintrayKey}" -PsonatypeUsername="${sonatypeUsername}" -PsonatypePassword="${sonatypePassword}" candidate
;;
*)
./gradlew -Prelease.travisci=true -Prelease.useLastTag=true -PbintrayUser="${bintrayUser}" -PbintrayKey="${bintrayKey}" -PsonatypeUsername="${sonatypeUsername}" -PsonatypePassword="${sonatypePassword}" final
;;
esac
if [[ $? -ne 0 ]]; then
exit 1
fi
./gradlew :osstracker-scraperapp:shadowJar
cd osstracker-scraperapp
docker build -t netflixoss/osstracker-scraper:$TRAVIS_TAG .
docker tag netflixoss/osstracker-scraper:$TRAVIS_TAG netflixoss/osstracker-scraper:latest
docker images
docker login -u=${dockerhubUsername} -p=${dockerhubPassword}
docker push netflixoss/osstracker-scraper:$TRAVIS_TAG
docker push netflixoss/osstracker-scraper:latest
cd ..
cd osstracker-console
docker build -t netflixoss/osstracker-console:$TRAVIS_TAG .
docker tag netflixoss/osstracker-console:$TRAVIS_TAG netflixoss/osstracker-console:latest
docker images
docker login -u=${dockerhubUsername} -p=${dockerhubPassword}
docker push netflixoss/osstracker-console:$TRAVIS_TAG
docker push netflixoss/osstracker-console:latest
cd ..
# No a valid build
else
echo -e 'WARN: Should not be here => Branch ['$TRAVIS_BRANCH'] Tag ['$TRAVIS_TAG'] Pull Request ['$TRAVIS_PULL_REQUEST']'
./gradlew build
fi