forked from fbpic/fbpic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
executable file
·41 lines (34 loc) · 1.17 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
35
36
37
38
39
40
#!/bin/bash
# This script updates the documentation and pushes to the corresponding
# Github repository
# See https://gist.github.com/domenic/ec8b0fc8ab45f39403dd
# Only push when updating master (i.e. new releases)
if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_BRANCH" != "master" ]; then
echo "Skipping deploy; just doing a build."
exit 0
fi
SHA=`git rev-parse --verify HEAD`
# Install sphinx, and build the documentation
pip install sphinx sphinx_rtd_theme
cd docs
make html
cd ..
# Get ssh credential to push to the documentation, using encrypted key
openssl aes-256-cbc -K $encrypted_12c8071d2874_key -iv $encrypted_12c8071d2874_iv -in deploy_key.enc -out deploy_key -d
chmod 600 deploy_key
eval `ssh-agent -s`
ssh-add deploy_key
# Clone the documentation repository
git clone [email protected]:fbpic/fbpic.github.io.git
# Remove the previous `dev` documentation
cd fbpic.github.io
git rm -r ./*
# Copy and add the new documentation
cp -r ../docs/build/html/* ./
git add ./*
# Configure git user and commit changes
git config user.name "Travis CI"
git config user.email "[email protected]"
git commit -m "Deploy to GitHub Pages: ${SHA}" || true
# Push to the repo
git push