-
Notifications
You must be signed in to change notification settings - Fork 2
/
.documentation.sh
executable file
·36 lines (25 loc) · 1.1 KB
/
.documentation.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
#!/bin/bash -e
# Based on: http://benlimmer.com/2013/12/26/automatically-publish-javadoc-to-gh-pages-with-travis-ci/
if [ "$TRAVIS_REPO_SLUG" != "peerlibrary/meteor-blaze-common-component" ] || [ "$TRAVIS_PULL_REQUEST" != "false" ] || [ "$TRAVIS_BRANCH" != "master" ]; then
exit 0
fi
if [ -z "$GH_TOKEN" ]; then
echo "GH_TOKEN environment variable missing."
exit 1
fi
echo "Generating documentation..."
npm install -g codo
codo base.coffee component.coffee mixin.coffee --output ./doc --name 'Common Component' --title 'Common Component Documentation' --readme README.md --undocumented
cd $HOME
git config --global user.email "travis@travis-ci.org"
git config --global user.name "Travis CI"
git config --global credential.helper store
echo "https://mitar:${GH_TOKEN}@github.com" > .git-credentials
git clone --branch=gh-pages 'https://github.com/peerlibrary/meteor-blaze-common-component.git' gh-pages
cd gh-pages
git rm -rf .
cp -R "$TRAVIS_BUILD_DIR/doc/." .
git add .
git commit -m "Documentation generated by Travis CI (build $TRAVIS_BUILD_NUMBER)."
git push origin gh-pages
echo "Published documentation."