forked from grails/grails-doc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
travis-build.sh
executable file
·47 lines (35 loc) · 1.28 KB
/
travis-build.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
#!/bin/bash
set -e
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
export GRADLE_OPTS="-Xmx2048m -Xms256m -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -XX:+HeapDumpOnOutOfMemoryError"
./gradlew assemble --info --stacktrace
if [[ $TRAVIS_PULL_REQUEST == 'false' ]]; then
# If there is a tag present then this becomes the latest
if [[ -n $TRAVIS_TAG ]]; then
git clone https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git -b gh-pages gh-pages --single-branch > /dev/null
cd gh-pages
version="$TRAVIS_TAG"
version=${version:1}
zipName="grails-docs-$version"
export RELEASE_FILE="${zipName}.zip"
git rm -rf latest/
mkdir -p latest
cp -r ../build/docs/. ./latest/
git add latest/*
majorVersion=${version:0:4}
majorVersion="${majorVersion}x"
mkdir -p "$version"
cp -r ../build/docs/. "./$version/"
git add "$version/*"
mkdir -p "$majorVersion"
cp -r ../build/docs/. "./$majorVersion/"
git add "$majorVersion/*"
git commit -a -m "Updating docs for Travis build: https://travis-ci.org/$TRAVIS_REPO_SLUG/builds/$TRAVIS_BUILD_ID"
git push origin HEAD
cd ..
rm -rf gh-pages
fi
fi