-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.travis_publish_docs
executable file
·44 lines (36 loc) · 1.1 KB
/
.travis_publish_docs
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
#!/bin/bash
#
# Trying to auto-publish docs on commits from main branch to gh-pages
#
# source: https://github.com/RubenVerborgh/AsyncIterator/commit/ac05f7675f9a2f5e9e8e74d59a9c5189dd4359b3
echo "Starting script on after_success ..."
# Only publish from the main repository's master branch
#
if [ "$TRAVIS_REPO_SLUG" != "yafp/monoto" ] || [ "$TRAVIS_BRANCH" != "master" ] || [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
echo $TRAVIS_REPO_SLUG
echo $TRAVIS_BRANCH
echo $TRAVIS_PULL_REQUEST
echo "Aborting script"
exit
fi
echo -e "Publishing docs...\n"
# Update docs in repository
#
DOCS=$PWD/docs
pushd $HOME
git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/yafp/monoto gh-pages 2>&1 > /dev/null
cd gh-pages
# Don't update if they are already at the latest version
if [[ `git log -1 --pretty=%B` == *$TRAVIS_COMMIT* ]]; then
exit
fi
git rm -rf docs
cp -r $DOCS docs
# Push latest version of docs
#
git add docs
git config user.name "Travis"
git config user.email "travis@travis-ci.org"
git commit -m "Update docs to $TRAVIS_COMMIT."
git push -fq origin gh-pages 2>&1 > /dev/null
popd