Skip to content

05 CI & CD with GitHub Actions & GitHub Pages

Dorien Huijser edited this page Jan 13, 2025 · 4 revisions

CI = Continuous Integration. This is the practice of automating the integration of (code) changes from multiple contributors into a single (software) project.

CD = Continuous Deployment. This is the practice of automatically launching the project to end-users via, for example, a website.

Continous Integration with GitHub Actions

GitHub Actions allows for automation of software workflows. In our case, we use GitHub Actions to automate building and deploying the Handbook.

This means the Handbook can 'live' on GitHub instead of someone's local computer folder. Contributors don't have to manually build the book on their computers with R Studio, the book is (re)built automatically on GitHub when changes are made/approved.

Continuous Deployment with GitHub Pages

GitHub Pages is a static site hosting service that takes HTML, CSS, and JavaScript files straight from a repository on GitHub, and publishes a website. The website is hosted on GitHub's github.io domain and the URL reflects the user/organization and repository. The Handbook's URL is, therefore: https://utrechtuniversity.github.io/dataprivacyhandbook

Note: Technically, GitHub Actions takes care of the Continuous Deployment via GitHub Pages as well - but it's easier to document the process by splitting CI & CD into sections.

The Workflow

The current workflow is located in dataprivacyhandbook -> .github -> workflows -> publish.yml. In addition, in the repository settings on GitHub, the publish.yml has been set as the source of the GitHub Pages website.

The workflow:

  • Is triggered when a change has been made to any of the files in the book folder of the GitHub repository
  • Installs the necessary dependencies, such as R, several R packages and LaTeX dependencies to be able to create the PDF output of the bookdown book
  • Renders the bookdown book
  • Uploads the rendering as an artifact
  • Deploys the rendering on GitHub pages