Skip to content

Commit 505ff82

Browse files
committed
Fix travis maven deployment
1 parent eb531af commit 505ff82

File tree

2 files changed

+29
-27
lines changed

2 files changed

+29
-27
lines changed

.travis.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ before_install:
1414
script:
1515
- "./gradlew :core:assembleRelease :ui:assembleRelease :ui-integration:assembleRelease
1616
:utils:assembleRelease"
17+
after_success:
18+
- "./travis_release.sh"
1719
cache:
1820
directories:
1921
- "$HOME/.gradle/caches/"
@@ -23,13 +25,6 @@ env:
2325
global:
2426
- secure: N3EBbTG204iyRystHZFo0iMbnfSPxXHO3N+ZNAAP5rFR+ONmvRlIb767q4pByvD9KDdyvbg6XNGDuLVpXcJGlZXauSMykpk6JnizQVLLUHsD7qJYi+v7osez4qvIuEP0kQ/JLUQAgzDL1kLFinDzullpbpqmwY0zIcc5xhclR7+XH7hbDIEgNiVnrDIzRg8cOpOYRFYQeMTq2n7D10LyO9BYEIJxpxukDcUbPe0XOeHYbDjY+eI/OFohsSOjovChmdhz70KpXDePpim0pBBNiYcFdxkTsljb1tOmMWtGL7OcKCzscIOIk+mSGT7+isDTdNmVvHVQAKchlC3+nuI4vIhLy9ErHnfNlKKCJd1cjsFXXXmEnMJRnLk3ULIH9yUSjOCXWnRCCAZPcKyBjdwGinCuHySZ+PcnlzFrY0A6kqPR1jcCZsP+YyQJL8mPsyXAObFAeisK9ipNFsPkEbdrjYnBMO/A1nB++Abw9A/xp0pvar15l2qP4gn2zbo36OYL5v4KvGfO53WMyeyp2elRdnUyMswU4LHt0VLUEiO3/uUfl5MjilQST9xPWE5lZ00elKEoznNXD/djeOLYXvWKcQ/65AX6kjky5NQX3GTjyVemvsKLDQVT0HlioHRwP7YMkrtlD+el0R1DVjFBQ68o7fKFcMXmfiXN5ryyM0DYgn8=
2527
deploy:
26-
- provider: script
27-
script: bash travis_release.sh
28-
skip_cleanup: true
29-
on:
30-
repo: snabble/Android-SDK
31-
tags: true
32-
branch: master
3328
- provider: releases
3429
skip_cleanup: true
3530
api_key:

travis_release.sh

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,38 @@ if [ -z $TRAVIS ]; then
55
exit 1
66
fi
77

8-
rm -rf build/maven-releases
9-
rm -rf build/maven-snapshots
10-
rm -rf maven-repository
8+
if git rev-parse "$TRAVIS_TAG" >/dev/null 2>&1; then
9+
echo "Uploading to maven repository..."
1110

12-
./gradlew uploadArchives
11+
rm -rf build/maven-releases
12+
rm -rf build/maven-snapshots
13+
rm -rf maven-repository
1314

14-
./travis_decrypt_file.sh github_deploy_key.gpg
15+
./gradlew uploadArchives
1516

16-
chmod 600 github_deploy_key
17-
eval $(ssh-agent -s)
18-
ssh-add github_deploy_key
17+
./travis_decrypt_file.sh github_deploy_key.gpg
1918

20-
if [ -d "build/maven-releases" ]; then
21-
git clone --depth 1 -b releases [email protected]:snabble/maven-repository.git maven-repository
22-
fi
19+
chmod 600 github_deploy_key
20+
eval $(ssh-agent -s)
21+
ssh-add github_deploy_key
2322

24-
if [ -d "build/maven-snapshots" ]; then
25-
git clone --depth 1 -b snapshots [email protected]:snabble/maven-repository.git maven-repository
26-
fi
23+
if [ -d "build/maven-releases" ]; then
24+
git clone --depth 1 -b releases [email protected]:snabble/maven-repository.git maven-repository
25+
fi
26+
27+
if [ -d "build/maven-snapshots" ]; then
28+
git clone --depth 1 -b snapshots [email protected]:snabble/maven-repository.git maven-repository
29+
fi
2730

28-
cd maven-repository
31+
cd maven-repository
2932

30-
cp -r ../build/maven-releases/* . 2>/dev/null
31-
cp -r ../build/maven-snapshots/* . 2>/dev/null
33+
cp -r ../build/maven-releases/* . 2>/dev/null
34+
cp -r ../build/maven-snapshots/* . 2>/dev/null
35+
36+
git add *
37+
git commit -m "[Travis-CI] release $TRAVIS_TAG commit $TRAVIS_COMMIT"
38+
git push
39+
else
40+
echo "Skipping deployment to maven repository, no tag set"
41+
fi
3242

33-
git add *
34-
git commit -m "[Travis-CI] release $TRAVIS_TAG commit $TRAVIS_COMMIT"
35-
git push

0 commit comments

Comments
 (0)