Skip to content

Commit 00f308d

Browse files
committed
add script to automatically build docs on travis
1 parent eeb38f8 commit 00f308d

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,6 @@ after_success:
3333
notifications:
3434
slack:
3535
secure: eD/LGUBVwbaFBsBALGmPVerRwF6/PRV3PoBpUYUmL7bKyBJZYwcFCb5t8thZvMF8lcHoF0e5xO7L8DoPuws2+mJCiSDH7QD3oGsLE9DoVMFKsIqvzv0oc6qrWf8LjPqcn3XBnXHOvmogRDaaeTCr8KuYEFtwqmwu3YW0/oWYPWk=
36+
env:
37+
global:
38+
- secure: "YCq6pTjxV15fNl0C2xov7bx22/X1YzYq4B347pUn+sywcptTG8Eh4KEKDwV8EPHGm1nExNAigMLTGbnjFqoxg/u7T3hDsewTkZz6Ma93hj3kwx1gDTd/6G8ICT7xHyMrFrHNVYE4ehnJm67M0UmY0K8qk6C7y/bh4xO3Nbg0Q8I="

bin/build_docs.sh

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#! /usr/bin/env bash
2+
3+
# Copied from github.com/sympy/sympy
4+
#
5+
# This file automatically deploys changes to http://synthicity.github.io/activitysim/.
6+
# This will only happen when building a non-pull request build on the master
7+
# branch of ActivitySim.
8+
# It requires an access token which should be present in .travis.yml file.
9+
#
10+
# Following is the procedure to get the access token:
11+
#
12+
# $ curl -X POST -u <github_username> -H "Content-Type: application/json" -d\
13+
# "{\"scopes\":[\"public_repo\"],\"note\":\"token for pushing from travis\"}"\
14+
# https://api.github.com/authorizations
15+
#
16+
# It'll give you a JSON response having a key called "token".
17+
#
18+
# $ gem install travis
19+
# $ travis encrypt -r sympy/sympy GH_TOKEN=<token> env.global
20+
#
21+
# This will give you an access token("secure"). This helps in creating an
22+
# environment variable named GH_TOKEN while building.
23+
#
24+
# Add this secure code to .travis.yml as described here http://docs.travis-ci.com/user/encryption-keys/
25+
26+
# Exit on error
27+
set -e
28+
29+
ACTUAL_TRAVIS_JOB_NUMBER=`echo $TRAVIS_JOB_NUMBER| cut -d'.' -f 2`
30+
31+
if [ "$TRAVIS_REPO_SLUG" == "synthicity/activitysim" ] && \
32+
[ "$TRAVIS_BRANCH" == "master" ] && \
33+
[ "$TRAVIS_PULL_REQUEST" == "false" ] && \
34+
[ "$ACTUAL_TRAVIS_JOB_NUMBER" == "1" ]; then
35+
36+
echo "Installing dependencies"
37+
conda install --yes --quiet sphinx numpydoc
38+
pip install sphinx_rtd_theme
39+
40+
echo "Building docs"
41+
cd docs
42+
make clean
43+
make html
44+
45+
cd ../../
46+
echo "Setting git attributes"
47+
git config --global user.email "[email protected]"
48+
git config --global user.name "Matt Davis"
49+
50+
echo "Cloning repository"
51+
git clone --quiet --single-branch --branch=gh-pages https://${GH_TOKEN}@github.com/synthicity/activitysim.git gh-pages > /dev/null 2>&1
52+
53+
cd gh-pages
54+
rm -rf *
55+
cp -R ../activitysim/docs/_build/html/* ./
56+
git add -A .
57+
58+
git commit -am "Update dev doc after building $TRAVIS_BUILD_NUMBER"
59+
echo "Pushing commit"
60+
git push -fq origin gh-pages > /dev/null 2>&1
61+
fi

0 commit comments

Comments
 (0)