mark cerqueira well-rounded nerd

Auto-Deploying This Blog

Update: After updating to Jekyll 3, GitHub Pages can successfully build my blog without any issues so I’m not using this setup anymore. Post will stay though in case it can help anyone else.

A long time ago I started generating my site locally and pushing it up to Github manually because Github Pages does not allow you to run custom plugins. This isn’t as painful as it sounds. A friendly internet hero – ixti – crafted a nice Rakefile that automated publishing.

But doing the publishing myself led to some workflow issues. Allowing GitHub Pages to do the work for you is nice because you only have to deal with one branch. Make changes to that branch, push to GitHub, and GitHub Pages would generate the site and deploy it. Everything is always in sync. The new workflow had me writing and crafting content on the source branch and then using the publishing command to generate my site locally and then it would push it to the master branch: the “deploy.” Separating the crafting and deploying steps meant I sometimes published content without pushing it into the source branch or I’d push content and not deploy it.

Continuous deployment via Travis

In keeping with 2016’s automation resolution, I set up my blog to auto-deploy itself. Using and adapting Domenic Denicola’s clear and helpful instructions, the new set-up has Travis run the automated publishing flow when any changes are pushed to the source branch. Turns out Travis is not only a great continuous integration tool, but can be adapted to be continuously deploying as well! No more pushing content to the source branch and running the publishing command locally; I’m back to just needing to push once.

# The blog's gotten big so rake publish pushes 75.05 MiB!
Writing objects: 100% (1052/1052), 75.05 MiB | 1.46 MiB/s, done.
Total 1052 (delta 166), reused 0 (delta 0)
 + f2e99be...3aea10b master -> master (forced update)

And there are a few more benefits including email notifications if something goes wrong during the publishing flow and no need to wait on a 70+ MB push when publishing, which is great when I’m tethered or in a rush.

This minor improvement isn’t mind-blowing, but it does make my interaction with blogging more streamlined and simple. That’s what my automating 2016 resolution is all about. Onwards!

git push origin source
# We're done. Walk away. Go outside. Eat a banana.