From 72a7509e5c076456a141310aa4667974ee22ddb4 Mon Sep 17 00:00:00 2001 From: Magesh Chandramouli Date: Wed, 2 Jan 2019 21:13:04 -0800 Subject: [PATCH 1/2] changes to deploy.sh to make it more readable --- .travis/deploy.sh | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/.travis/deploy.sh b/.travis/deploy.sh index a53acb0..45bf51f 100755 --- a/.travis/deploy.sh +++ b/.travis/deploy.sh @@ -1,27 +1,26 @@ #!/bin/bash cd `dirname $0`/.. -if [ "$TRAVIS_BRANCH" != 'master' ] || [ "$TRAVIS_PULL_REQUEST" != 'false' ]; then - echo "Skipping artifact deployment for a non-release build" - exit 0 -fi - -if [[ -z "$SONATYPE_USERNAME" || -z "$SONATYPE_PASSWORD" ]]; then +if [ "${TRAVIS_BRANCH}" == 'master' -a "${TRAVIS_PULL_REQUEST}" == 'false' ]; then + if [[ -z "${SONATYPE_USERNAME}" || -z "${SONATYPE_PASSWORD}" ]]; then echo "ERROR! Please set SONATYPE_USERNAME and SONATYPE_PASSWORD environment variable" exit 1 -fi + fi -if [ ! -z "$TRAVIS_TAG" ]; then - echo "travis tag is set -> updating pom.xml attribute to $TRAVIS_TAG" - ./mvnw --batch-mode --settings .travis/settings.xml --no-snapshot-updates -Prelease -DskipTests=true -DreleaseVersion=$TRAVIS_TAG release:prepare -else + if [ ! -z "${TRAVIS_TAG}" ]; then + echo "travis tag is set -> updating pom.xml attribute to ${TRAVIS_TAG}" + ./mvnw --batch-mode --settings .travis/settings.xml --no-snapshot-updates -Prelease -DskipTests=true -DreleaseVersion=${TRAVIS_TAG} release:prepare + else echo "no travis tag is set, hence keeping the snapshot version in pom.xml" -fi + fi -./mvnw --batch-mode --settings .travis/settings.xml -Prelease clean deploy -DskipTests=true -B -U -SUCCESS=$? -if [ ${SUCCESS} -eq 0 ]; then + ./mvnw --batch-mode --settings .travis/settings.xml -Prelease clean deploy -DskipTests=true -B -U + SUCCESS=$? + if [ ${SUCCESS} -eq 0 ]; then echo "successfully deployed the jars to nexus" + fi + + exit ${SUCCESS} fi -exit ${SUCCESS} +exit 0 From 20ed8d30306dc98d46a0a0b1d6d80c0a7d5e2545 Mon Sep 17 00:00:00 2001 From: Magesh Chandramouli Date: Wed, 2 Jan 2019 21:28:33 -0800 Subject: [PATCH 2/2] fixing deploy script --- .travis/deploy.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis/deploy.sh b/.travis/deploy.sh index 45bf51f..70c90d0 100755 --- a/.travis/deploy.sh +++ b/.travis/deploy.sh @@ -1,7 +1,7 @@ #!/bin/bash cd `dirname $0`/.. -if [ "${TRAVIS_BRANCH}" == 'master' -a "${TRAVIS_PULL_REQUEST}" == 'false' ]; then +if [ "${TRAVIS_BRANCH}" == 'master' -a "${TRAVIS_PULL_REQUEST}" == 'false' ] || [ -n "${TRAVIS_TAG}" ]; then if [[ -z "${SONATYPE_USERNAME}" || -z "${SONATYPE_PASSWORD}" ]]; then echo "ERROR! Please set SONATYPE_USERNAME and SONATYPE_PASSWORD environment variable" exit 1 @@ -21,6 +21,8 @@ if [ "${TRAVIS_BRANCH}" == 'master' -a "${TRAVIS_PULL_REQUEST}" == 'false' ]; th fi exit ${SUCCESS} +else + echo "Skipping artifact deployment for branch ${TRAVIS_BRANCH} with PR=${TRAVIS_PULL_REQUEST} and TAG=${TRAVIS_TAG}" fi exit 0