Notes on code, technology, caffeine and everything in between.

Automated Deployments

Nov 21, 2023
tl;dr: I automated deployment of this Blog

Until now, I used to write a blog post and just run a shell script called that runs a hugo build command and rsyncs the whole folder to my dockerized web server. I wrote a post about that a year ago.

I was fine with that, until something in my environment broke and I had to tinker around until it worked again. So I’ve decided to re-build the deployment process using github actions. Now by blog gets deployed automatically everytime I run ‘git push’, which is amazing for someone like me, who is lazy and has no time to waste.

It turned out that I had to spend more time failing to automate the whole thing than I’d rather spend on just running, but I’ve learned some things.

As posting the whole script would be a slight overkill (and google is full of examples), here’s only my key learnings:

  • Checking out another Git repo than the one of the blog is a pain, as you need to generate at least an access token if it is a private one (my theme is that kind of repo)
  • The repo running the action is always checked out into branch name (main in my case) as a folder name
  • Using github secrets for storing server auth data is quite cool but I have no clue how they securely store that stuff
  • There’s an action plugin (are they even called plugins?) for almost anything you need, but it never fits 100% of your needs
  • Debugging a Github action is a pain

But hey, when you read this post, it got automatically deployed!

// edit: also, I am now able to write blog posts from any device with a web browser, using Github code spaces. [sent from my iphone]