1. a existen github project.
  2. a conf.json to success to generate jsdoc html files into out/ dir.
  3. a Travis account - .
  4. Install Ruby Gem

Enable project on travis-ci

Go to your profile page of travis-ci, for example

If your project is not in the list, try press button “Sync account”.

Then press the switch button on the left of project name.

create gh-pages for a existen project on github.

cd ~/source/tims-ocr-api
git branch -a
git checkout --orphan gh-pages
git rm -rf .
echo "test" > index.html
git add index.html
git commit -m "clean publish branch"
git push --set-upstream origin gh-pages

Switch to development branch

git checkout master

Create github personal access token or use existen one

for example a1b2c3d4e5f6

Encrypt your access token

Install travis command line tool, if you don’t have one.

$ gem install travis
$ travis encrypt GH_TOKEN=a1b2c3d4e5f6

Detected repository as yyssc/tims-ocr-api, is this correct? |yes| yes
Please add the following to your .travis.yml file:

secure: "Ky/lA272zNC0..............................BtBEf9q+edjc="

Pro Tip: You can add it automatically by running with --add.

add secure: ... to .travis.yml config file. (A example .travis.yml config file another example)

add GH_TOKEN=a1b2c3d4e5f6 to Environment Variables

create post script .utility/


if [ "$TRAVIS_REPO_SLUG" == "yyssc/tims-ocr-api" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then

  echo -e "Publishing jsdoc...\n"

  cp -R "out/tims-ocr-api/2.0.5" $HOME/jsdoc-latest

  cd $HOME
  git config --global ""
  git config --global "travis-ci"
  git clone --quiet --branch=gh-pages https://${GH_TOKEN} gh-pages > /dev/null

  cd gh-pages
  git rm -rf ./jsdoc
  cp -Rf $HOME/jsdoc-latest ./jsdoc
  git add -f .
  git commit -m "Latest jsdoc on successful travis build $TRAVIS_BUILD_NUMBER auto-pushed to gh-pages"
  git push -fq origin gh-pages > /dev/null

  echo -e "Published Javadoc to gh-pages.\n"

add to post hook.

$ cat .travis.yml
  - .utility/

See also