-
Notifications
You must be signed in to change notification settings - Fork 4
/
travis.script.sh
executable file
·47 lines (41 loc) · 1.6 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
#!/bin/bash
#exit script on any error
set -e
# shellcheck disable=SC2034
{
#Shell Colour constants for use in 'echo -e'
#e.g. echo -e "My message ${GREEN}with just this text in green${NC}"
RED='\033[1;31m'
GREEN='\033[1;32m'
YELLOW='\033[1;33m'
BLUE='\033[1;34m'
NC='\033[0m' # No Colour
}
#establish what version we are building
EXTRA_BUILD_ARGS=()
if [ -n "$TRAVIS_TAG" ]; then
#Tagged commit so use that as our version, e.g. v1.2.3
PRODUCT_VERSION="${TRAVIS_TAG}"
# GPG sign the artifacts, publish to nexus then close and release
# the staging repo to the public nexus repo and on to central
EXTRA_BUILD_ARGS=(
"signMavenJavaPublication"
"publishToSonatype"
"closeAndReleaseSonatypeStagingRepository"
)
else
#No tag so use the branch name as the version, e.g. master-SNAPSHOT
#None tagged builds are NOT pushed to bintray
PRODUCT_VERSION="${TRAVIS_BRANCH}-SNAPSHOT"
EXTRA_BUILD_ARGS=()
fi
#Dump all the travis env vars to the console for debugging
echo -e "TRAVIS_BUILD_NUMBER: [${GREEN}${TRAVIS_BUILD_NUMBER}${NC}]"
echo -e "TRAVIS_COMMIT: [${GREEN}${TRAVIS_COMMIT}${NC}]"
echo -e "TRAVIS_BRANCH: [${GREEN}${TRAVIS_BRANCH}${NC}]"
echo -e "TRAVIS_TAG: [${GREEN}${TRAVIS_TAG}${NC}]"
echo -e "TRAVIS_PULL_REQUEST: [${GREEN}${TRAVIS_PULL_REQUEST}${NC}]"
echo -e "TRAVIS_EVENT_TYPE: [${GREEN}${TRAVIS_EVENT_TYPE}${NC}]"
echo -e "PRODUCT_VERSION: [${GREEN}${PRODUCT_VERSION}${NC}]"
#Run the build (including running maven install task to generate poms
./gradlew -Pversion="${PRODUCT_VERSION}" clean build "${EXTRA_BUILD_ARGS[@]}"