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
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.
+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.
To manage this website, I use an automated CI / CD workflow:
-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:
[...]
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 nighEDIT: 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.
+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.
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.
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):
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):
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/ -