Skip to content

Commit 65dcbe8

Browse files
move after_deploy.sh to deploy stage to fail the build on error in after_deploy.sh script
The exit code of after_success, after_failure, after_script and subsequent stages do not affect the build result.
1 parent d017df7 commit 65dcbe8

File tree

2 files changed

+37
-36
lines changed

2 files changed

+37
-36
lines changed

.travis.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,14 @@ deploy:
2828
repo: CurrencyFair/OneSignal-Java-SDK
2929
tags: true
3030
jdk: oraclejdk8
31-
32-
after_deploy:
33-
- .travis/after_deploy.sh
31+
-
32+
provider: script
33+
script: .travis/after_deploy.sh
34+
skip_cleanup: true
35+
on:
36+
repo: CurrencyFair/OneSignal-Java-SDK
37+
tags: true
38+
jdk: oraclejdk8
3439

3540
notifications:
3641
slack:

.travis/after_deploy.sh

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -18,38 +18,34 @@ increment_version_to_next_snapshot ()
1818
new_snapshot="${new// /.}-SNAPSHOT"
1919
}
2020

21-
# increment version to the next snapshot version, commit and push to repository
22-
if [ ! -z "$TRAVIS_TAG" ]
23-
then
24-
# Get the deploy key by using Travis's stored variables to decrypt deploy_key.enc
25-
openssl aes-256-cbc \
26-
-K $encrypted_dd04a63e1379_key \
27-
-iv $encrypted_dd04a63e1379_iv \
28-
-in .travis/github_deploy_key.enc \
29-
-out .travis/github_deploy_key -d
30-
chmod 600 .travis/github_deploy_key
31-
eval `ssh-agent -s`
32-
ssh-add .travis/github_deploy_key
33-
git config --global user.name "$GIT_NAME"
34-
git config --global user.email "$GIT_EMAIL"
21+
# Get the deploy key by using Travis's stored variables to decrypt deploy_key.enc
22+
openssl aes-256-cbc \
23+
-K $encrypted_dd04a63e1379_key \
24+
-iv $encrypted_dd04a63e1379_iv \
25+
-in .travis/github_deploy_key.enc \
26+
-out .travis/github_deploy_key -d
27+
chmod 600 .travis/github_deploy_key
28+
eval `ssh-agent -s`
29+
ssh-add .travis/github_deploy_key
30+
git config --global user.name "$GIT_NAME"
31+
git config --global user.email "$GIT_EMAIL"
3532

36-
# increment version to the next snapshot version
37-
increment_version_to_next_snapshot $TRAVIS_TAG
38-
echo "on a tag -> set pom.xml <version> to next SNAPSHOT $new_snapshot"
39-
mvn --settings .travis/mvnsettings.xml org.codehaus.mojo:versions-maven-plugin:2.3:set -DnewVersion=$new_snapshot
40-
mvn --settings .travis/mvnsettings.xml org.codehaus.mojo:versions-maven-plugin:2.3:commit
33+
# increment version to the next snapshot version
34+
increment_version_to_next_snapshot $TRAVIS_TAG
35+
echo "on a tag -> set pom.xml <version> to next SNAPSHOT $new_snapshot"
36+
mvn --settings .travis/mvnsettings.xml org.codehaus.mojo:versions-maven-plugin:2.3:set -DnewVersion=$new_snapshot
37+
mvn --settings .travis/mvnsettings.xml org.codehaus.mojo:versions-maven-plugin:2.3:commit
4138

42-
# Save some useful information
43-
REPO=$(git config remote.origin.url)
44-
REPO=${REPO/https:\/\/github.com\//git@github.com:}
45-
REPO_NAME=$(basename $REPO)
46-
TARGET_DIR=$(mktemp -d /tmp/$REPO_NAME.XXXX)
47-
git clone --branch master ${REPO} ${TARGET_DIR}
48-
yes | cp -f pom.xml $TARGET_DIR/
49-
cd $TARGET_DIR
50-
# Finally add changed pom.xml and commit
51-
git add pom.xml
52-
git commit -m "[skip ci] [Travis-CI] next snapshot version via Travis build $TRAVIS_BUILD_NUMBER"
53-
# Now that we're all set up, we can push
54-
git push $REPO master
55-
fi
39+
# Save some useful information
40+
REPO=$(git config remote.origin.url)
41+
REPO=${REPO/https:\/\/github.com\//git@github.com:}
42+
REPO_NAME=$(basename $REPO)
43+
TARGET_DIR=$(mktemp -d /tmp/$REPO_NAME.XXXX)
44+
git clone --branch master ${REPO} ${TARGET_DIR}
45+
yes | cp -f pom.xml $TARGET_DIR/
46+
cd $TARGET_DIR
47+
# Finally add changed pom.xml and commit
48+
git add pom.xml
49+
git commit -m "[skip ci] [Travis-CI] next snapshot version via Travis build $TRAVIS_BUILD_NUMBER"
50+
# Now that we're all set up, we can push
51+
git push $REPO master

0 commit comments

Comments
 (0)