Skip to content

Commit 878c014

Browse files
committed
Build documentation on Travis.
1 parent 4fdcb37 commit 878c014

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ script:
77
- npm run lint
88
- npm test
99
- npm run browser
10+
- npm run docs
1011
after_success:
1112
- npm run coveralls
13+
- ./.travis_build_pages
1214
cache:
1315
directories:
1416
- node_modules

.travis_build_pages

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
# Only publish from the main repository's master branch
3+
REPO_NAME="RubenVerborgh/N3.js"
4+
if [ "$TRAVIS_REPO_SLUG" != "$REPO_NAME" ] || [ "$TRAVIS_BRANCH" != "master" ] || [ "$TRAVIS_PULL_REQUEST" != "false" ]; then exit; fi
5+
echo -e "Generating gh-pages...\n"
6+
7+
# Checkout the gh-pages branch
8+
REPO_PATH=$PWD
9+
pushd $HOME
10+
git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/$REPO_NAME gh-pages 2>&1 > /dev/null
11+
cd gh-pages
12+
13+
# Don't update if already at the latest version
14+
if [[ `git log -1 --pretty=%B` == *$TRAVIS_COMMIT* ]]; then exit; fi
15+
16+
# Update pages
17+
rm -r docs 2> /dev/null
18+
cp -r $REPO_PATH/docs .
19+
20+
# Commit and push latest version
21+
git add .
22+
git config user.name "Travis"
23+
git config user.email "[email protected]"
24+
git commit -m "Update to $TRAVIS_COMMIT."
25+
git push -fq origin gh-pages 2>&1 > /dev/null
26+
popd

0 commit comments

Comments
 (0)