File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
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
4
6
- if [ " $TRAVIS_REPO_SLUG " == " watson-developer-cloud/node-sdk" ] && [ " $TRAVIS_PULL_REQUEST " == " false" ] && [ " $TRAVIS_BRANCH " == " master" ] && [ " $TRAVIS_TAG " ]; then
5
+ # checking the build/job numbers allows it to only publish once even though we test against multiple node.js versions
6
+
7
+ if [ " $TRAVIS_REPO_SLUG " == " watson-developer-cloud/node-sdk" ] && [ " $TRAVIS_PULL_REQUEST " == " false" ] && [ " $TRAVIS_BRANCH " ] && [ " $TRAVIS_BUILD_NUMBER .1" == " $TRAVIS_JOB_NUMBER " ]; then
7
8
8
9
echo " Publishing JSDoc..."
9
10
@@ -12,16 +13,21 @@ if [ "$TRAVIS_REPO_SLUG" == "watson-developer-cloud/node-sdk" ] && [ "$TRAVIS_PU
12
13
git clone --quiet --branch=gh-pages https://${GH_TOKEN} @github.com/watson-developer-cloud/node-sdk gh-pages > /dev/null
13
14
14
15
pushd gh-pages
15
- cp -Rf ../doc/watson-developer-cloud/* ./
16
+ # on tagged builds, $TRAVIS_BRANCH is the tag (e.g. v1.2.3), otherwise it's the branch name (e.g. master)
17
+ rm -rf $TRAVIS_BRANCH
18
+ mkdir $TRAVIS_BRANCH
19
+ cp -Rf ../doc/watson-developer-cloud/* /* ./$TRAVIS_BRANCH
16
20
git add -f .
17
- git commit -m " JSDdoc for $TRAVIS_TAG "
21
+ git commit -m " JSDdoc for $TRAVIS_BRANCH ( $TRAVIS_COMMIT ) "
18
22
git push -fq origin gh-pages > /dev/null
19
23
popd
20
24
21
- echo -e " Published JSDoc for $TRAVIS_TAG to gh-pages.\n"
25
+ # todo: whip up a quick index file that links to all subdirs
26
+
27
+ echo -e " Published JSDoc for $TRAVIS_BRANCH to gh-pages.\n"
22
28
23
29
else
24
30
25
- echo -e " Not publishing docs for tag $TRAVIS_TAG on branch $TRAVIS_BRANCH of repo $TRAVIS_REPO_SLUG "
31
+ echo -e " Not publishing docs for build $TRAVIS_BUILD_NUMBER ( $TRAVIS_JOB_NUMBER ) on branch $TRAVIS_BRANCH of repo $TRAVIS_REPO_SLUG "
26
32
27
33
fi
You can’t perform that action at this time.
0 commit comments