forked from grails/grails-spring-security-rest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdoc.sh
executable file
·52 lines (40 loc) · 1.77 KB
/
doc.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
#!/bin/bash
set -e
set -x
if [[ $TRAVIS_PULL_REQUEST == 'false' ]]; then
./gradlew asciidoctor aggregateGroovyDoc
version=`cat build.gradle | grep "version \"" | sed -n 's/^[ \t]*version\ "//pg' | sed -n 's/"//pg'`
echo "Preparing release of version $version"
echo "Configuring git with name ${GIT_NAME} and email ${GIT_EMAIL}"
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 --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages > /dev/null
cd gh-pages
./gradlew generateIndex
# If there is a tag present then this becomes the latest
if [[ -n $TRAVIS_TAG ]]; then
rm -rf latest/
mkdir -p latest/docs/gapi
cp -r ../spring-security-rest-docs/build/asciidoc/html5/. ./latest/docs
cp -r ../build/docs/groovydoc/. latest/docs/gapi
git add latest/*
rm -rf "$version"
mkdir -p "$version/docs/gapi"
cp -r ../spring-security-rest-docs/build/asciidoc/html5/. "$version/docs"
cp -r ../build/docs/groovydoc/. "$version/docs/gapi"
git add "$version/*"
fi
if [[ $TRAVIS_BRANCH == 'develop' && $TRAVIS_REPO_SLUG == 'alvarosanchez/grails-spring-security-rest' ]]; then
rm -rf next/
mkdir -p next/docs/gapi
cp -r ../spring-security-rest-docs/build/asciidoc/html5/. ./next/docs
cp -r ../build/docs/groovydoc/. next/docs/gapi
git add next/*
fi
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