Skip to content

Commit dcbed63

Browse files
committed
generate docs on every build, publish on tagged builds
fixes watson-developer-cloud#161
1 parent d01494c commit dcbed63

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

.travis.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@ node_js:
66
- stable
77
script:
88
- npm test
9+
- npm run doc
910
after_success:
1011
- npm run coveralls
12+
- jsdoc/publish.sh
1113
before_install:
12-
- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && openssl aes-256-cbc -K $encrypted_cb4d3d070e32_key -iv $encrypted_cb4d3d070e32_iv -in auth.js.enc -out test/resources/auth.js -d || true'
14+
- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && openssl aes-256-cbc -K $encrypted_cb4d3d070e32_key
15+
-iv $encrypted_cb4d3d070e32_iv -in auth.js.enc -out test/resources/auth.js -d ||
16+
true'
17+
env:
18+
global:
19+
secure: I50FnfubwiZlol5Qs9tXPVACGbs+SG2dJLjpbzeio0Hl666d/hDuvf7IFwqqaRjQkmK2TdIjaGLMOgHxh/GGAoYf7LfZqjDID/tAhgoFOYiZwiPj66Z82F9P9cega2nkNW+125NzPuU3rhSCByG8+K/PMH/5JxPwPMoAYNLQjWc=

jsdoc/publish.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
# based on http://benlimmer.com/2013/12/26/automatically-publish-javadoc-to-gh-pages-with-travis-ci/
4+
# todo: add && [ "$TRAVIS_TAG" != "" ] after confirming it works otherwise
5+
6+
if [ "$TRAVIS_REPO_SLUG" == "watson-developer-cloud/node-sdk" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_TAG" ]; then
7+
8+
echo "Publishing JSDoc..."
9+
10+
git config --global user.email "[email protected]"
11+
git config --global user.name "travis-ci"
12+
git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/watson-developer-cloud/node-sdk gh-pages > /dev/null
13+
14+
pushd gh-pages
15+
cp -Rf ../doc/watson-developer-cloud/* ./
16+
git add -f .
17+
git commit -m "JSDdoc for $TRAVIS_TAG"
18+
git push -fq origin gh-pages > /dev/null
19+
popd
20+
21+
echo -e "Published JSDoc for $TRAVIS_TAG to gh-pages.\n"
22+
23+
else
24+
25+
echo -e "Not publishing docs for tag $TRAVIS_TAG on branch $TRAVIS_BRANCH of repo $TRAVIS_REPO_SLUG"
26+
27+
fi

0 commit comments

Comments
 (0)