This blog has continuous integration

It’s probably not a surprise for most of the people reading this blog but I am a software engineer. And as such I spend most of my time writing code, checked in a VCS, reviewed by peers and analyzed by tools before being deployed.

Isn’t it only natural that the content of this blog followed the same rules?

For some time now, this blog has been written in Markdown and transformed into a static website using Hugo.

This works pretty well — especially since the deployment is semi-automated via a few lines of bash — but occasionally a few mistakes end-up being deployed. Incorrectly formatted Markdown, words misspelled or even insensitive/inconsiderate writing (English not being my native tongue doesn’t help).

Like I would do with any piece of code, I decided to introduce a Continuous Integration pipeline in order to minimize the risks. And to be fair, it was also the perfect occasion to play a bit with GitHub Actions!

This pipeline relies on four different actions:

The action definition looks like this:

 1name: CI
 2on: [pull_request]
 3
 4jobs:
 5  markdown:
 6    runs-on: ubuntu-latest
 7
 8    steps:
 9      - uses: actions/checkout@v1
10        with:
11          depth: 1
12
13      - uses: nosborn/github-action-markdown-cli@master
14        with:
15          files: ./content/
16
17  language:
18    runs-on: ubuntu-latest
19
20    steps:
21      - uses: actions/checkout@v1
22        with:
23          depth: 1
24
25      - uses: reviewdog/action-misspell@v1
26        with:
27          github_token: ${{ github.token }}
28          locale: "US"
29
30      - name: alexjs
31        uses: theashraf/alex-action@master
32
33  build:
34    runs-on: ubuntu-latest
35
36    steps:
37      - uses: actions/checkout@v1
38        with:
39          depth: 1
40
41      - uses: peaceiris/actions-hugo@v2.3.0
42        with:
43          hugo-version: '0.59.1'
44
45      - run: hugo

And as a bonus, the deployment is also automated using a GitHub action (written by me, this time):

 1name: Deploy
 2on:
 3  push:
 4    branches: [master]
 5
 6jobs:
 7  hugo_deploy:
 8    name: Hugo
 9    runs-on: ubuntu-latest
10
11    steps:
12      - uses: actions/checkout@v1
13        with:
14          depth: 1
15          submodules: true
16          token: ${{ secrets.GITHUB_PERSONAL_ACCESS_TOKEN }}
17
18      - uses: K-Phoen/hugo-gh-pages-action@master
19        with:
20          github_token: ${{ secrets.GITHUB_PERSONAL_ACCESS_TOKEN }}

The only thing left for me is to start writing more!