+ Octopress + Travis-CI + GitHub Pages = ♥

I wanted to have nice workflow to write to my octopress-powered blog. So idea was:

  1. I’m editing or creating post in or just in GitHub’s web editor.
  2. Wonderful open-source free hosted continious integration server Travis-CI builds my Octopress blog and pushes generated version back to GitHub Pages

Nice settings for to edit Octopress blog

First, I need to be nice with octopress. I added these lines to end of _config.yml of Octopress blog:

  rooturl: "source"
    "source/_posts": |
      layout: post
      title: "Title"
      comments: true
      published: true

Thats exactly what it looks like. It tells, which directory to load, and specifies Octopress’s metadata.


It’s a pain. This is my .travis.yml:

It’s kinda complex :) You just have to put your encoded SSH key instead of mine (all - secure: lines) and put your repo address (- REPO=). To encode SSH key for Travis I used this gist:

It works like magic!

PS. So, it builds on Travis twice. First time when you are pushing to source branch - Travis generates static site and pushes it back to master branch (to GitHub Pages). That push triggers second build on Travis, although I have branches: only: source in my .travis.yml on source branch. As workaround, I’m echoing script: "ls *.html" to master’s .travis.yml. Still, on each my blog update, Travis creates 2 VM. I hope it’s not so abusive.

blog comments powered by Disqus