The Automated Workflow I Use to Manage This Website

The website

This website is built with the HUGO static website generator using the anatole theme.
The website’s source code is hosted in this GitHub repository.

Automated CI / CD workflow

Every changes I make (e.g. creating a new article, update the theme, add new parameters to the website, …) are done in my local git repository on the dev branch.
Once the changes are pushed to GitHub, I create a pull request from the dev branch to the main branch, which triggers CI / CD pipelines (running on my own self-hosted runners):

alt_text

CI

The CI pipeline has one “Test” stage which, as the name implies, runs a bunch of tests (e.g. spellcheckers & linters):

alt_text

alt_text

CD

The CD pipeline has two stages:

alt_text

  • The “Build” stage:

The “Build” stage builds the website via hugo and then commits the built changes to my repository (still on the dev branch).

alt_text

  • The “Deploy” stage:

Once the “Build” stage has finished successfully, the “Deploy” stage is triggered.

alt_text

It allows to automatically deploy the website by remotely triggering the dedicated related job on my Jenkins server. This Jenkins job can either target my dev or prod environment for the deployment (the former being hosted on a virtual server in my homelab, the latter being hosted on a VPS), thanks to a dedicated parameter.

alt_text

Under the hood, this Jenkins job runs a simple Ansible playbook (see that playbook here) that aims to update the website’s sources on the targeted environment against the related GitHub branch (dev branch –> development environment, main branch –> production environment).

When opening a pull request from the dev branch to the main branch on the GitHub side, the “Deploy” stage of the “CD” pipeline remotely triggers the Jenkins job targeting the dev environment. My changes are thus automatically deployed and I can review them on my development environment.

Once I reviewed the changes on my development environment and they are ready to go to production, I can just merge the pull request to the main branch which will trigger a new run of the “CD” pipeline with the “Deploy” stage targeting the prod environment this time!

This workflow may evolve and be improved over time but it’s a good example of a simple; yet effective, flexible and reliable automated CI / CD workflow you can use to manage your projects! 😄