forked from Samreay/WorkshopExample
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
34 lines (32 loc) · 1.22 KB
/
deploy.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
#!/usr/bin/env bash
if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_BRANCH" != "master" ]; then
echo "Not on master branch, nor pull request. Not building doco"
exit 0;
fi
if [ -n "$GITHUB_API_KEY" ]; then
echo "Github key found. Building documentation."
cd "$TRAVIS_BUILD_DIR"/doc
make clean
make html
if [ "$TRAVIS_PYTHON_VERSION" != "3.6" ]; then
cd "$TRAVIS_BUILD_DIR"
rm -rf .git/
cd doc/_build/html
git config --global user.email "travis"
git config --global user.name "travis"
# Create the nojekyll file so Github doesnt try to build for us
touch .nojekyll
git init
git add .
echo "Committing Github Pages"
git commit -m init
# Make sure to make the output quiet, or else the API token will leak!
# This works because the API key can replace your password.
echo "Pushing"
git push -f -q "https://${GITHUB_API_KEY}@${GH_REF}" master:gh-pages > /dev/null 2>&1 && echo "Pushed"
fi
else
echo "GITHUB_API_KEY not found."
echo "Please set the GITHUB_API_KEY environment variable in travis to a Github personal access token with public_repo permission"
fi
echo "Deploy script ending"