forked from grails/gorm-mongodb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
travis-publish.sh
executable file
·82 lines (61 loc) · 2.39 KB
/
travis-publish.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
echo "Publishing..."
EXIT_STATUS=0
if [[ "${TRAVIS_JDK_VERSION}" == "openjdk11" || "${TRAVIS_JDK_VERSION}" == "openjdk14" ]] ; then
exit $EXIT_STATUS
fi
echo "Publishing for branch $TRAVIS_BRANCH JDK: $TRAVIS_JDK_VERSION"
if [[ $TRAVIS_REPO_SLUG == "grails/gorm-mongodb" && $TRAVIS_PULL_REQUEST == 'false' && $EXIT_STATUS -eq 0 ]]; then
echo "Publishing archives"
export GRADLE_OPTS="-Xmx1500m -Dfile.encoding=UTF-8"
if [[ $TRAVIS_TAG =~ ^v[[:digit:]] ]]; then
# for releases we upload to Bintray and Sonatype OSS
if [[ -n $TRAVIS_TAG ]]; then
./gradlew publish bintrayUpload --no-daemon --stacktrace || EXIT_STATUS=$?
else
./gradlew publish --no-daemon --stacktrace || EXIT_STATUS=$?
fi
else
echo "publishing snapshot"
# for snapshots only to repo.grails.org
./gradlew publish --no-daemon --stacktrace || EXIT_STATUS=$?
fi
if [[ $EXIT_STATUS -eq 0 ]]; then
echo "Publishing Successful."
echo "Publishing Documentation..."
./gradlew docs:docs
git config --global user.name "$GIT_NAME"
git config --global user.email "$GIT_EMAIL"
git config --global credential.helper "store --file=~/.git-credentials"
echo "https://$GH_TOKEN:@github.com" > ~/.git-credentials
git clone https://${GH_TOKEN}@github.com/grails/grails-data-mapping.git -b gh-pages gh-pages --single-branch > /dev/null
cd gh-pages
if [[ -n $TRAVIS_TAG ]]; then
version="$TRAVIS_TAG"
version=${version:1}
majorVersion=${version:0:4}
majorVersion="${majorVersion}x"
mkdir -p "$version/mongodb"
cp -r ../docs/build/docs/. "./$version/mongodb/"
git add "$version/mongodb/*"
mkdir -p "$majorVersion/mongodb"
cp -r ../docs/build/docs/. "./$majorVersion/mongodb/"
git add "$majorVersion/mongodb/*"
else
# If this is the master branch then update the snapshot
mkdir -p snapshot/mongodb
cp -r ../docs/build/docs/. ./snapshot/mongodb/
git add snapshot/mongodb/*
fi
git commit -a -m "Updating MongoDB Docs for Travis build: https://travis-ci.org/$TRAVIS_REPO_SLUG/builds/$TRAVIS_BUILD_ID"
git push origin HEAD
cd ..
rm -rf gh-pages
if [[ $EXIT_STATUS -eq 0 ]]; then
if [[ -n $TRAVIS_TAG ]]; then
./gradlew synchronizeWithMavenCentral --no-daemon
fi
fi
fi
fi
exit $EXIT_STATUS