-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathdeploy-docs.sh
executable file
·60 lines (42 loc) · 1.11 KB
/
deploy-docs.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
#!/bin/bash
# This script builds the documentation and pushes it to github
GH_REPO_REF="github.com/$TRAVIS_REPO_SLUG"
set -e
JAVADOC_DIR=$(pwd)/target/site/apidocs
# Build the javadocs
mvn -DskipTests clean javadoc:aggregate
# Activate virtualenv
virtualenv -p python3 venv
. venv/bin/activate
cd docs
rm -rf ./_build
# Install dependencies
pip install -r requirements.txt
# Build docs
make html
cd _build
# Configure git
git config --global push.default simple
git config user.name "Travis CI"
git config user.email "[email protected]"
# Clone docs branch
git clone -b gh-pages https://git@$GH_REPO_REF docs-upload
cd docs-upload
# Remove existing docs
rm -rf *
# Copy docs from build to repo
cp -r ../html/* ./
# Copy javadocs
rm -rf ./javadocs
mv "$JAVADOC_DIR" ./javadocs
echo "" > .nojekyll
if [[ -f "index.html" ]]; then
# Commit
git add --all
git commit -m "Deploy code docs to GitHub Pages Travis build"
export GH_REPO_TOKEN="trinopoty@${GH_TOKEN}"
git push --force "https://${GH_REPO_TOKEN}@${GH_REPO_REF}" > /dev/null 2>&1
else
echo 'ERROR: index.html not found'
exit 1
fi