Publishing to GitHub Pages Automatically

Publishing to GitHub Pages Automatically

You know, precise and correct documentation is the one kept in synch with the source code automatically.

There are many ways of doing that, many kinds of documentation. Here I’ll show you how to publish content in GitHub Pages after a successful build. In this case, the content is a API specification generated when running acceptance tests. 

How to do it?

  1. Put the content you want to be published in the /docs dir
  2. Go to Settings, find the GitHub Pages section, and select Source to master branch /docs folder, then press Save 
  3. Push it to master.

The content in the /docs will be available at or

An Example?

eHelp is configured to put its generated specs in the /docs folder. Every time we push to master, its GitHub Page gets updated. This way, its specs are always published and always in sync.

The Past – In Case You Are Curious

(It’s nice to see that things are getting simpler.)

Not so long ago, I wrote a post (Tip #1) explaining how to achieve the same result using Travis CI and some scripting help. This little project is configured the old way: see travis.yml and files.

More Help

You can find more information at GitHub help pages: