From 78f3ffd1ca394604efebd5e4d59a70e9345b162b Mon Sep 17 00:00:00 2001
From: GitHub Actions This website is built with the HUGO static website generator using the anatole theme. Every changes I made (e.g. creating a new article, update the theme, add new parameters to the website, …) are done in my local git repository on the 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
The website’s source code is hosted in this GitHub repository.Automated CI / CD workflow
-dev
branch.
+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):
[...]
Read More diff --git a/public/blog/index.xml b/public/blog/index.xml index 7294387..a58e8ab 100644 --- a/public/blog/index.xml +++ b/public/blog/index.xml @@ -59,7 +59,7 @@ After a quick thought, I understood that a power outage occurred during the nigh <p>This website is built with the <a href="https://gohugo.io/">HUGO</a> static website generator using the <a href="https://github.com/lxndrblz/anatole">anatole</a> theme.<br> The website’s source code is hosted in <a href="https://github.com/Antiz96/antiz.fr/">this GitHub repository</a>.</p> <h2 id="automated-ci--cd-workflow">Automated CI / CD workflow</h2> -<p>Every changes I made (e.g. creating a new article, update the theme, add new parameters to the website, …) are done in my local git repository on the <a href="https://github.com/Antiz96/antiz.fr/tree/dev"><code>dev</code> branch</a>.<br> +<p>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 <a href="https://github.com/Antiz96/antiz.fr/tree/dev"><code>dev</code> branch</a>.<br> Once the changes are pushed to GitHub, I create a pull request from the <code>dev</code> branch to the main branch, which triggers CI / CD pipelines (running on my own self-hosted runners):</p> diff --git a/public/blog/website-workflow/index.html b/public/blog/website-workflow/index.html index fe89280..714e937 100644 --- a/public/blog/website-workflow/index.html +++ b/public/blog/website-workflow/index.html @@ -129,7 +129,7 @@ @@ -140,7 +140,7 @@ @@ -164,7 +164,7 @@ "alternativeHeadline": "", "description": " - \u003ch2 id=\u0022the-website\u0022\u003eThe website\u003c\/h2\u003e\n\u003cp\u003eThis website is built with the \u003ca href=\u0022https:\/\/gohugo.io\/\u0022\u003eHUGO\u003c\/a\u003e static website generator using the \u003ca href=\u0022https:\/\/github.com\/lxndrblz\/anatole\u0022\u003eanatole\u003c\/a\u003e theme.\u003cbr\u003e\nThe website\u0026rsquo;s source code is hosted in \u003ca href=\u0022https:\/\/github.com\/Antiz96\/antiz.fr\/\u0022\u003ethis GitHub repository\u003c\/a\u003e.\u003c\/p\u003e\n\u003ch2 id=\u0022automated-ci--cd-workflow\u0022\u003eAutomated CI \/ CD workflow\u003c\/h2\u003e\n\u003cp\u003eEvery changes I made (e.g. creating a new article, update the theme, add new parameters to the website, \u0026hellip;) are done in my local git repository on the \u003ca href=\u0022https:\/\/github.com\/Antiz96\/antiz.fr\/tree\/dev\u0022\u003e\u003ccode\u003edev\u003c\/code\u003e branch\u003c\/a\u003e.\u003cbr\u003e\nOnce the changes are pushed to GitHub, I create a pull request from the \u003ccode\u003edev\u003c\/code\u003e branch to the main branch, which triggers CI \/ CD pipelines (running on my own self-hosted runners):\u003c\/p\u003e + \u003ch2 id=\u0022the-website\u0022\u003eThe website\u003c\/h2\u003e\n\u003cp\u003eThis website is built with the \u003ca href=\u0022https:\/\/gohugo.io\/\u0022\u003eHUGO\u003c\/a\u003e static website generator using the \u003ca href=\u0022https:\/\/github.com\/lxndrblz\/anatole\u0022\u003eanatole\u003c\/a\u003e theme.\u003cbr\u003e\nThe website\u0026rsquo;s source code is hosted in \u003ca href=\u0022https:\/\/github.com\/Antiz96\/antiz.fr\/\u0022\u003ethis GitHub repository\u003c\/a\u003e.\u003c\/p\u003e\n\u003ch2 id=\u0022automated-ci--cd-workflow\u0022\u003eAutomated CI \/ CD workflow\u003c\/h2\u003e\n\u003cp\u003eEvery changes I make (e.g. creating a new article, update the theme, add new parameters to the website, \u0026hellip;) are done in my local git repository on the \u003ca href=\u0022https:\/\/github.com\/Antiz96\/antiz.fr\/tree\/dev\u0022\u003e\u003ccode\u003edev\u003c\/code\u003e branch\u003c\/a\u003e.\u003cbr\u003e\nOnce the changes are pushed to GitHub, I create a pull request from the \u003ccode\u003edev\u003c\/code\u003e branch to the main branch, which triggers CI \/ CD pipelines (running on my own self-hosted runners):\u003c\/p\u003e @@ -214,7 +214,7 @@ , "url" : "https:\/\/antiz.fr\/blog\/website-workflow\/", - "wordCount" : "394", + "wordCount" : "389", "genre" : [ ], "keywords" : [ ] } @@ -441,7 +441,7 @@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.
Every changes I made (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.
+
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):
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.
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, the “Deploy” stage of my GitHub CD pipeline automatically triggers the related Jenkins job (which itself triggers the related Ansible playbook) targeting my dev
environment, so my changes gets 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!
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! 😄