How to use GitHub Actions to update a Jekyll blog

Thomas Dickson

2 minute read

I implemented a GitHub Actions workflow to make it easier for me to update my blog. I’ve previously written here about my blog setup. Since I initially deployed my blog I found running the update script to from a specific machine quite limiting. This post describes how I implemented a GitHub Action workflow to build my Jekyll blog and then copy the files to the Droplet where I serve it.

GitHub Actions is GitHub’s offering to the world of workflow automation and CI/CD. It’s similar to GitLab CI/CD and Jenkins, for example. I’ve chosen to use GitHub actions as I don’t want to change my version control provider and, for a change, I don’t mind using a solution to automate friction away now that I can own the process from first principles. GitHub Actions is also free for under 2000 minutes of use per month so I’m not out of pocket for using it either. Each run of the pipeline takes under a minute, so I think I’ve got quite a few goes to max out my capacity.

The diagram below shows the different steps in the workflow I implemented. I found this post helpful for the first few stages of building a Jekyll website and this one helped show me how to use rsync`1 to copy the generated files to my droplet.

graph LR F(Action configuration) --> A(Start Ubuntu runner) --> B(Checkout repo) --> C(Configure Ruby) --> D(Build Jekyll blog) --> E(Copy files to Droplet)

I made a few decisions when implementing the workflow:

  1. Whenever I see rsync I’m reminded of the classic HN comment about Dropbox. Always good to keep in mind how apparently simple technological solutions can solve big problems in the real world.