Garbage Collector

Tales from an old nibble


Moving to github actions to publish the blog

Table of Contents

What is this all about #

This blog started locally on my machine a long time ago, when I was mainly using a single computer. Nowadays I work with multiple machines and I wanted to move the actual creation of the blog and publishing to github actions to avoid having to keep in sync all my machines.

As a bonus, I’m writing this article from github’s editor and the workflow will take care of publishing the article when I push this changes.

Nuts and Bolts #

There is a lot of documentation online. As it is natural, some of it is not up to date. The best option is to follow github’s help and use the default workflow that they make available for Hugo, the static website generator I’m using for this site.

I had to update a few thinks to fit this into my existing workflow.

HTTPS, APEX and WWW domain #

I’m using my own domain for this website, but the pages are hosted by github-pages. Githubs provides a documentation on how to setup your custom domain and it added over time support for the HTTPS protocol managing automatically the certificates with Let’s Encrypt. This has evolved over time and I managed to keep my setup up-to-date. However I saw that I the site was missing a valid certificate when using the www subdomain: https://www.pietromaggi.com.

I’ve looked around and, at the end, it was simply my (obsolete) configuration that needed to be updated su described in GitHub’s documentation. Also registering my domain helped!.

Renaming the default branch #

While I was on GitHub, I though that it was a good idea to move the default branch to main. Again, GitHub’s help provides all the information on how to change this. A nice touch is that the guide also includes the instructions on how to update the local repository, an additional step I did locally was to purge the branches to remove all the references to master:

1
git fetch --prune

My only issue was to remember to update my workflow (that was still using master) and to update the name of the branch allowed to be deployed on gh-pages in the settings.

Cleanup #

I had a few leftover articles in the old private repository that I didn’t want to transition to this new instance. Obviously I remembered about them only after I pushed a couple of commits to GitHub. So I rewrote the history (git rebase -i <hash>) and used The Silver Searcher to remove the offending files:

1
ag -l "draft: true" | xargs rm

Additional cleanup is still due in some of the older articles. Hugo updated/expanded the syntax for the cross-references and I started, slowly, fixing some of the older articles.

Roadmap #

The idea is that this new setup, with a lower friction, should help me write a bit more. That’s the plan!