Automated Jekyll Deployment Using GitHub Actions
I’ve not written here much over the last decade or so (2 posts since 16 December 2014, in fact!), but I want to at least give myself a chance of writing more, so I started thinking about what make that happen. I switched this blog over to Jekyll in about 2011 I think, but all deployments were still very much manual.
In some ways, I miss the original way I built this blog, on Movable Type (one day I will bring over all that content) - I could edit easily on my phone (even in 2004), I could use desktop writing apps like MarsEdit, and the eventual output was static (good for performance reasons).
Anyway, I decided it would make sense to figure out how to deploy the Jekyll output directly to my server. After a bit of back and forth (mostly pinning versions), and using Automating Jekyll Deployments with GitHub Actions as a starting point, I now have it working, woo. Below is my workflow file for reference, but the main changes to the article from 2020 were:
- Switch to use
ruby/setup-ruby@v1
(instead ofactions/setup-ruby@v1
) - Pin a more recent Ruby version for the latest version of Jekyll
- Use sftp to copy files over to the server (all variables are held in GitHub’s secrets)
_site
is of course just the default target directory used by the Jekyll build process, so you’d need to change that if you have it set up to output somewhere else.
Anyway, hopefully this post is useful for someone else in future - worst case, it will act as external memory for me when I want to repeat this process for another site.