diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml index d807db0..c4b89e0 100644 --- a/.github/workflows/CD.yml +++ b/.github/workflows/CD.yml @@ -1,8 +1,12 @@ name: CD -on: pull_request +on: + pull_request: + push: + branches: + - main jobs: - Build: + Checkout: runs-on: - self-hosted - CI-CD @@ -14,6 +18,13 @@ jobs: token: ${{ secrets.BUILD_WEBSITE_TOKEN }} ref: ${{ github.event.pull_request.head.ref }} + Build: + needs: Checkout + runs-on: + - self-hosted + - CI-CD + + steps: - name: Init theme submodule run: git submodule update --init @@ -34,3 +45,21 @@ jobs: else echo "No changes to commit" fi + + Deploy: + needs: Build + runs-on: + - self-hosted + - CI-CD + + steps: + - name: Deploy website + run: | + if [ "$(git rev-parse --abbrev-ref HEAD)" == "dev" ]; then + /opt/github-runner/antiz.fr/deploy_website.sh dev + elif [ "$(git rev-parse --abbrev-ref HEAD)" == "main" ]; then + /opt/github-runner/antiz.fr/deploy_website.sh prod + else + echo "Invalid branch, nothing to deploy" + exit 1 + fi diff --git a/content/blog/website-workflow.md b/content/blog/website-workflow.md index f99cf41..415c6d3 100644 --- a/content/blog/website-workflow.md +++ b/content/blog/website-workflow.md @@ -4,6 +4,8 @@ date: 2023-07-24T13:20:26+02:00 draft: false --- +EDIT: This article is slitghly outdated as the workflow I use to maintain this website has evolved and improved over time. I'll eventually write a V2 of that article at some point. + ## The website This website is built with the [HUGO](https://gohugo.io/) static website generator using the [anatole](https://github.com/lxndrblz/anatole) theme. @@ -34,7 +36,7 @@ The [test job](https://github.com/Antiz96/antiz.fr/blob/main/.github/workflows/C ### CD -Once both of the above CI jobs succeeded (meaning the website has been successfully built, pushed to the dev branch of the repository, and the tests went through without any error), I launch a job on my [Jenkins](https://www.jenkins.io/) server targeting the dev environment: +Once both of the above CI jobs succeeded (meaning the website has been successfully built, pushed to the dev branch of the repository, and the tests went through without any error), I launch a job on my [Jenkins](https://www.jenkins.io/) server targeting the dev environment *(edit: the trigger of that job is now automated via GitHub actions as well): ![alt_text](../../images/Jenkins_Update_Website_Job_Dev.png "Jenkins - Update Website Job Dev") diff --git a/public/404.html b/public/404.html index 92c2a2a..a16c1f6 100644 --- a/public/404.html +++ b/public/404.html @@ -18,7 +18,7 @@ - + - +

The automated workflow I use to manage this website

24 July 2023
-

The website

+

EDIT: This article is slitghly outdated as the workflow I use to maintain this website has evolved and improved over time. I’ll eventually write a V2 of that article at some point.

+

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 workflow

-

To manage this website, I use an automated CI / CD workflow:

-

CI

-

I make my changes (creating an new article, update the theme, add new parameters to the website, etc…) locally on my computer inside the git repository in the dev branch.
-Once the changes are done, I push them to the GitHub repository and I create a pull request from the dev branch to the main one, which triggers a CI pipeline:

+The website’s source code is hosted in this GitHub repository.

[...]

Read More diff --git a/public/blog/index.xml b/public/blog/index.xml index 65cb558..a42aa3f 100644 --- a/public/blog/index.xml +++ b/public/blog/index.xml @@ -55,14 +55,10 @@ After a quick thought, I understood that a power outage occurred during the nigh https://antiz.fr/blog/website-workflow/ - <h2 id="the-website">The website</h2> + <p>EDIT: This article is slitghly outdated as the workflow I use to maintain this website has evolved and improved over time. I&rsquo;ll eventually write a V2 of that article at some point.</p> +<h2 id="the-website">The website</h2> <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&rsquo;s source code is hosted in <a href="https://github.com/Antiz96/antiz.fr/">this GitHub repository</a>.</p> -<h2 id="automated-workflow">Automated workflow</h2> -<p>To manage this website, I use an automated CI / CD workflow:</p> -<h3 id="ci">CI</h3> -<p>I make my changes <em>(creating an new article, update the theme, add new parameters to the website, etc&hellip;)</em> locally on my computer inside the git repository in the dev branch.<br> -Once the changes are done, I push them to the GitHub repository and I create a pull request from the dev branch to the main one, which triggers a CI pipeline:</p> +The website&rsquo;s source code is hosted in <a href="https://github.com/Antiz96/antiz.fr/">this GitHub repository</a>.</p> diff --git a/public/blog/maintaining-and-building-alpine-packages-from-arch-linux/index.html b/public/blog/maintaining-and-building-alpine-packages-from-arch-linux/index.html index 87f5bc9..d4939e6 100644 --- a/public/blog/maintaining-and-building-alpine-packages-from-arch-linux/index.html +++ b/public/blog/maintaining-and-building-alpine-packages-from-arch-linux/index.html @@ -18,7 +18,7 @@ - + - + - + - + @@ -139,11 +137,9 @@ - + @@ -166,7 +162,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-workflow\u0022\u003eAutomated workflow\u003c\/h2\u003e\n\u003cp\u003eTo manage this website, I use an automated CI \/ CD workflow:\u003c\/p\u003e\n\u003ch3 id=\u0022ci\u0022\u003eCI\u003c\/h3\u003e\n\u003cp\u003eI make my changes \u003cem\u003e(creating an new article, update the theme, add new parameters to the website, etc\u0026hellip;)\u003c\/em\u003e locally on my computer inside the git repository in the dev branch.\u003cbr\u003e\nOnce the changes are done, I push them to the GitHub repository and I create a pull request from the dev branch to the main one, which triggers a CI pipeline:\u003c\/p\u003e + \u003cp\u003eEDIT: This article is slitghly outdated as the workflow I use to maintain this website has evolved and improved over time. I\u0026rsquo;ll eventually write a V2 of that article at some point.\u003c\/p\u003e\n\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 @@ -216,7 +212,7 @@ , "url" : "https:\/\/antiz.fr\/blog\/website-workflow\/", - "wordCount" : "372", + "wordCount" : "418", "genre" : [ ], "keywords" : [ ] } @@ -439,7 +435,8 @@

The Automated Workflow I Use to Manage This Website

2-minute read -

The website

+

EDIT: This article is slitghly outdated as the workflow I use to maintain this website has evolved and improved over time. I’ll eventually write a V2 of that article at some point.

+

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 workflow

@@ -459,7 +456,7 @@

CI

The test job automatically runs a bunch of tests / linters against the website’s files in the repository, to make sure the changes I made are correctly written / syntaxed.

CD

-

Once both of the above CI jobs succeeded (meaning the website has been successfully built, pushed to the dev branch of the repository, and the tests went through without any error), I launch a job on my Jenkins server targeting the dev environment:

+

Once both of the above CI jobs succeeded (meaning the website has been successfully built, pushed to the dev branch of the repository, and the tests went through without any error), I launch a job on my Jenkins server targeting the dev environment *(edit: the trigger of that job is now automated via GitHub actions as well):

alt_text

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):

alt_text

diff --git a/public/blog/welcome/index.html b/public/blog/welcome/index.html index 3a51cef..a216c0a 100644 --- a/public/blog/welcome/index.html +++ b/public/blog/welcome/index.html @@ -18,7 +18,7 @@ - + - + - + - + https://antiz.fr/blog/website-workflow/ - <h2 id="the-website">The website</h2> + <p>EDIT: This article is slitghly outdated as the workflow I use to maintain this website has evolved and improved over time. I&rsquo;ll eventually write a V2 of that article at some point.</p> +<h2 id="the-website">The website</h2> <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&rsquo;s source code is hosted in <a href="https://github.com/Antiz96/antiz.fr/">this GitHub repository</a>.</p> -<h2 id="automated-workflow">Automated workflow</h2> -<p>To manage this website, I use an automated CI / CD workflow:</p> -<h3 id="ci">CI</h3> -<p>I make my changes <em>(creating an new article, update the theme, add new parameters to the website, etc&hellip;)</em> locally on my computer inside the git repository in the dev branch.<br> -Once the changes are done, I push them to the GitHub repository and I create a pull request from the dev branch to the main one, which triggers a CI pipeline:</p> +The website&rsquo;s source code is hosted in <a href="https://github.com/Antiz96/antiz.fr/">this GitHub repository</a>.</p> diff --git a/public/tags/index.html b/public/tags/index.html index 799b75e..5be2d97 100644 --- a/public/tags/index.html +++ b/public/tags/index.html @@ -18,7 +18,7 @@ - +