Hugo blog - Deployment automation with Github

Automating Hugo blog deployment using Github Actions!


I am currently porting over from an old VPS on Linode running Centos 6 and a smattering of old stuff. It was previously running a Wordpress install. It’s working fine, but I feel like running a DB + WebServer + PHP for a simple blog is way too overkill.

The idea was to move to a static framework where I could host the actual content the easiest way possible. I’ve picked Hugo just based of my liking of the product and the abundance of free themes.

Here is the final setup :

  • Hugo 0.59.0
  • GitHub Pages
  • Auto-deployment with Github Actions when content is pushed into the repository.
  • Binario theme with syntax highlight

Github workflow

name: hugo-build
on: [push]
    runs-on: ubuntu-latest
    - uses: actions/[email protected]
    - name: Build the hugo static files.
      run: |
        sudo docker run --rm -v $(pwd):/src laurentfdumont/laurent-hugo hugo
    - name: Commit new files.
      run: |
        git config --local "[email protected]"
        git config --local "GitHub Action"
        git add .
        git commit -m "Automatic GitHub Actions commit" -a
    - name: Push changes.
      uses: ad-m/[email protected]
        github_token: ${{ secrets.GITHUB_TOKEN }}

Breaking it down

Laurent Dumont
I route packets and juggle bytes