-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdeploy_doc.sh
More file actions
executable file
·50 lines (38 loc) · 1.39 KB
/
deploy_doc.sh
File metadata and controls
executable file
·50 lines (38 loc) · 1.39 KB
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
#!/bin/bash
set -e # Exit with nonzero exit code if anything fails
SOURCE_BRANCH="master"
TARGET_BRANCH="gh-pages"
# Pull requests and commits to other branches shouldn't try to deploy, just build to verify
if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_BRANCH" != "$SOURCE_BRANCH" ]; then
echo "Skipping deployment of documentation."
exit 0
fi
# Save some useful information
REPO=`git config remote.origin.url`
SSH_REPO=${REPO/https:\/\/github.com\//git@github.com:}
SHA=`git rev-parse --verify HEAD`
# Clone repository and checkout 'gh-pages'
git clone $REPO SpacyDoc
cd SpacyDoc
git checkout $TARGET_BRANCH
# Remove old documentation
rm -rf doc/*
# Add new documentation
mv $TRAVIS_BUILD_DIR/build/doc/* doc/
# Set git user
git config user.name "Travis CI"
git config user.email "lubkoll@posteo.de"
# If there are no changes to the compiled out (e.g. this is a README update) then just bail.
if [ -z `git diff --exit-code` ]; then
echo "No changes to the output on this push; exiting."
exit 0
fi
# Add new documentation to git
git add --all doc/*
git commit -m"Update documentation for commit: ${SHA}"
openssl aes-256-cbc -K $encrypted_25bd1d90568b_key -iv $encrypted_25bd1d90568b_iv -in travisci_rsa.enc -out travisci_rsa -d
chmod 600 travisci_rsa
eval `ssh-agent -s`
ssh-add travisci_rsa
# Push new documentation
git push ${REPO/https:\/\/github.com\//git@github.com:} $TARGET_BRANCH