24 Oct 2016

This article will take about 3 minutes to read.

Update, November 2017

I don’t use this setup anymore, it might be outdated, proceed with caution.

Original post

As I already mentioned, GitHub pages do not work with the Jekyll plugins. It is a security measure. So I researched it a bit, and colleague of mine proposed a simple solution - Travis CI.

There is a great repo with instructions how to set everything up - jekyll-travis. But few steps are kinda confusing, and it took me 10 failed builds to make it work. So I’ll try to help you with those.

I copied the steps from the original repo and updated steps where I got stuck. Be sure to check the original readme as well.


Steps to make it work

source "http://production.cf.rubygems.org/"

gem "rake", "~> 10.1.1"
gem "jekyll-paginate"
gem "jekyll-archives"

We have seen intermittent timeouts fetching gems from Rubygems.org. install: bundle install lets Travis CI automatically retry, and we are using source "http://production.cf.rubygems.org/" in Gemfile to point to a different repository.

language: ruby
- 2.3.1
- bundle install
script: bundle exec rake site:deploy --quiet

Replace the YOUR_ENCRYPTED_INFO with the output of the following command:

travis encrypt 'GIT_NAME="Your Username" GIT_EMAIL="your@email.com" GH_TOKEN=GITHUB_PERSONAL_TOKEN_YOU_CREATED'
# GitHub
username:             Stanko
repo:                 Stanko.github.io
branch:               source

# Jekyll source / destination
source:               .
destination:          _site

And you are done! That should be it, of course you need to create a Travis CI account. Travis is free for the open source projects. If you are using it for the commercial stuff, play fair and check their payed tiers.

Build for my blog takes about a minute. It depends of the software Travis installs on every build.

Now you can use custom plugins and asset pipeline with Jekyll. Cheers!


Comments (4)

Lars Olesen
27 Sep 2017, 09:14 PM

I’ve been trying a lot of different setups to get https://github.com/vih/historie/tree/master to work using this setup, but nothing is working for me so far. Maybe you have the magic word and can see what my mistake is?

27 Sep 2017, 10:11 PM

Hello Lars,

I’ll take a look, but I can’t promise anything :)

Meanwhile I have a cheesy advice - you could clone my blog’s repo, and replace the posts and theme.

Btw how are you doing it at the moment, are you building it locally and pushing everything to gh-pages by hand?


Lars Olesen
28 Sep 2017, 11:49 AM

I know there is no promises :) Right now, I just let Github take care of the building in the gh-branch. Basically, the dfference might be that it is not a user or organization website?

01 Oct 2017, 06:31 PM

Hey Lars,

I downloaded your blog’s repo and dug around but I couldn’t get Travis working :(

I’m pretty sure that it doesn’t matter if it is a user or organization.

Personally, I would start setup from scratch following this link: github.com/mfenner/jekyll-travis.

If you manage to get everything working, please share your solution.