trashpanda.cc

Kohlenstoff-basiert Zweibeiniges Säugetier

Bearblogging

It’s truth universally acknowledged that a person in possession of opposable thumbs an a modicum of programming skills must be in want of an over-elaborate web publishing workflow.

My basic blog setup is based on Hugo, which is a static site generator that renders Markdown files into web pages. I write the Markdown files locally, then push the changes to GitHub, after which a deployment job in Render is triggered. This checks out the latest revision, builds it, and published the resulting static HTML.

It all works very well, but it does depend on creating, committing and pushing Markdown files. That’s not easy to do on something that isn’t a laptop - not that Markdown is difficult, but there’s no good combination of both iOS GitHub client and an iOS Markdown editor.

What iOS and Mac do have is Bear, which is a beautifully-designed notes tool that I use extensively as an outboard brain. It’s ideal for banging out short and medium length files, but it doesn’t fit at all into a Hugo workflow.

Until now. The process I’ve come up with isn’t exactly elegant, but it is seamless.

  • I write the content in Bear, and email the resulting file to myself as a Markdown file
  • My mail server files the email into the right folder based on sender and subject
  • Periodically, a cron job wakes up a Node app running in a Docker container on Render by pinging a webhook URL
  • The Node app checks for waiting email; grabs the message; downloads the attachment, renders it into a Hugo-style Markdown file, saves it locally, then pushes the new file up to GitHub.
  • The my website’s Render project watches its repo, and whenever a change is detected it runs the deploy process I described above.
  • I can force the whole process by pinging the webhook URL to wake the Node app up manually.

No, this was not exactly trivial to setup.

Yes, there are quite a lot of moving parts.

Yes, I probably did take it all a bit far. It’s a bit over the top just for the sake of sticking with a specific text editor. On the other hand, it was a learning process, particularly the “devopsy” bits of building and deploying Docker containers; and wrangling the connections to IMAP servers.

Will I actually use this, to keep this site updated more often? To be determined…