-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathattempt-travis-deploy.sh
More file actions
38 lines (33 loc) · 1.54 KB
/
attempt-travis-deploy.sh
File metadata and controls
38 lines (33 loc) · 1.54 KB
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
#!/usr/bin/env bash
readonly SNAPSHOTS_BRANCH='development'
readonly RELEASES_BRANCH='master'
echo 'Attempting to deploy artifacts'
# Verify that JAVA_HOME is set
if [[ -z ${JAVA_HOME} ]]; then # Exit if JAVA_HOME is unset
echo 'JAVA_HOME variable is unset, exiting'
exit 1;
fi
echo "JAVA_HOME = ${JAVA_HOME}"
echo 'Retrieving project version'
# Get project version using special script
project_version=$(bash project-version.sh)
echo "Got project version: ${project_version}"
if [[ ${project_version} == *-SNAPSHOT ]]; then # Try to deploy snapshot if version ends with '-SNAPSHOT'
echo 'This is a snapshot version'
# Snapshots deployment happens only for `development` branch excluding pull requests to it (but including merges)
if [[ "${TRAVIS_BRANCH}" = "${SNAPSHOTS_BRANCH}" ]]; then
echo "Deploying version ${project_version} to snapshot repositories"
bash .travis/scripts/deploy-snapshot-to-maven-repositories.sh
else
echo "Not deploying snapshot as branch is not ${SNAPSHOTS_BRANCH}"
fi
else # Try to deploy release if version doesn't end with '-SNAPSHOT'
echo 'This is a release version'
# Release deployment happens only for `release` branch excluding pull requests to it (but including merges)
if [[ "${TRAVIS_BRANCH}" = "${RELEASES_BRANCH}" ]]; then
echo "Deploying version ${project_version} to release repositories"
bash .travis/scripts/deploy-release-to-maven-repositories.sh
else
echo "Not deploying release as branch is not \`${SNAPSHOTS_BRANCH}\`"
fi
fi