How to use GitHub Actions to update a Jekyll blog

A GitHub Actions workflow that builds my Jekyll blog and deploys it to a Droplet with rsync, triggered by pushes to one branch and pull requests to main.



Updating a blog by running scripts from a specific machine is limiting. This post describes how to use GitHub Actions to automate the process—building a Jekyll blog and deploying files to a server.

GitHub Actions provides workflow automation and CI/CD, similar to GitLab CI/CD and Jenkins. It integrates with your existing GitHub repository, avoiding vendor lock-in, and offers a generous free tier (2,000 minutes per month). For this workflow, each run completes in roughly 45 seconds, leaving substantial headroom within the free allocation.

The diagram below shows the different steps in the workflow I implemented. The workflow draws on two resources: this guide for building Jekyll, and this one for deploying with rsync1.

Loading diagram…

I made a few decisions when implementing the workflow:

  • I stored two configuration values as repository secrets: the SSH key for authentication, and the rsync parameters defining which files to copy. This keeps sensitive data out of version control.
  • The workflow triggers on two events: pushes to the gh-actions branch (for testing changes to the workflow itself) and pull requests to main (to validate changes before deployment). PRs to main carry deployment risk, which could be mitigated with a separate staging environment or manual approval step, but the current setup reflects the blog’s low traffic and low stakes.

Footnotes

  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. ↩