03 March 2016 Jekyll, GitHub Pages, Travis CI Robert Muehsig


Short recap: GitHub Pages & Jekyll

This blog is powered by GitHub Pages, which uses Jekyll in the background. Jekyll is a static website generator, which means that this page is “build” and has no server-side rendering logic when you hit the page - it’s pure static HTML, CSS and JS.

You could run Jekyll on your local box and publish the sites to GitHub Pages - I prefer a pure “GitHub Page”-based model. Actually I don’t even have Jekyll installed on my PC. I wrote a small blogpost about running Jekyll on Windows if you are interested.

Travis CI

As you might imaging - during the build stuff can break. In this case GitHub will send you a very short “error” email via mail. To get a more detailed report, GitHub suggests to use Travis CI, which is the main topic of this blogpost.

Travis CI Setup

The basic setup is pretty simple, but I had some issues - the last step is not very good documented - and that’s why I decided to blog about it.

1. Login to Travis CI and “sync” your account

You will need to login to Travis CI with your GitHub account. This will kick in a “sync”. After a short period you should see all your repositories on your profile page:


2. Enable the desired project on Travis CI

Just flip on the switch on your profil page for the desired project and Travis will watch the repository for any changes.

3. Adding a Gemfile and a .travis.yml file to your project

To build GitHub Page stuff via Travis you will need a Gemfile and a .tarvis.yml. My current files are pretty basic and a copy from the GitHub Pages Help site, with one important exception

4. Targeting the correct branch

The last step is to ensure that Travis CI will search for the correct branch. In my case, I only have the “gh-pages” branch, but Travis CI will look for a “master” branch.

To configure Travis CI to use the correct “gh-pages” branch you will need this config section inside the .yml:

 - gh-pages  

After this setup you should already see the finished Travis CI build:


Important: The output of the build will not be copied over to GitHub - at this stage it is just a “safety net”. If you want to publish from Travis CI, there are many blogposts out there that describe this topic.

Hope this helps!

Written by Robert Muehsig

Software Developer - from Saxony, Germany - working on primedocs.io. Microsoft MVP & Web Geek.
Other Projects: KnowYourStack.com | ExpensiveMeeting | EinKofferVollerReisen.de