Skip to content

Commit

Permalink
2024-07-29/01: add "Quick bits: why you should automate everything"
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagokokada committed Jul 29, 2024
1 parent 060c8ac commit 0fb553a
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
45 changes: 45 additions & 0 deletions 2024-07-29/01-quick-bits-why-you-should-automate-everything.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Quick bits: why you should automate everything

If everything works as expected this blog post should appear in [in my
blog](https://kokada.capivaras.dev/) without I ever touching the
<capivaras.dev> website. I rewrote my [previous Python
script](https://kokada.capivaras.dev/blog/using-github-as-a-bad-blog-platform/)
to Go
([permalink](https://github.com/thiagokokada/blog/blob/3c39e0f7cd58b1af885f69871490b05bf6fc7d99/blog.go))
since my attempt to generate proper description to the RSS feed resulted in
slow startup times (not because of Python, but because of my usage of
`nix-shell` since I didn't want to deal with
[venv](https://docs.python.org/3/library/venv.html) or anything to manage my
Python dependencies).

My previous workflow of this blog already involved me writing the texts in
[neovim](https://neovim.io/), copying and pasting the result in the
<capivaras.dev> website and publishing. This was not that bad, except that it
seems I have a heavy tendency of editing my posts multiple times. Copying and
pasting data between neovim and the website became tedious, so I decided to
give up and automate the whole process.

[Mataroa](https://mataroa.blog/) (the blog platform <capivaras.dev> run) has a
reasonable good [API](https://mataroa.blog/api/docs/), and it only took a few
hours to get a version of publishing working (it would take less if
[Django](https://www.djangoproject.com/), the framework Mataroa is written, did
not have a weird behavior with URLs missing a trailing `/`). An additional few
lines of
[YAML](https://github.com/thiagokokada/blog/blob/51b20612335c7f4312a51a0f436235b4b701ce8b/.github/workflows/go.yml)
to make GitHub Actions trigger a pipeline and now I should never have to
manually update my blog again.

I could have not done this. I mean, I probably wasted more time writing an
automation than I actually wasted publishing manually. But the manual process
is easy to miss, and I already did multiple mistakes publishing in the manual
method. For example, when writing the Markdown files, each post is written in a
particular format, where the first header is considered the title, so I need to
remove it from the contents during publication. But of course, this is easy to
miss, and I had to fix this multiple times already.

So yes, I think this is a good lesson on why you should automate everything. It
is more than just about [time savings](https://xkcd.com/1205/), it is about
reducing mistakes and even documenting (even if poorly) a process. I mean, the
code I wrote is not that great, but I can definitely rely on it in the future
to remember what I need to do. It will be much faster than trying to learn from
scratch again.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ rss.xml: blog $(MARKDOWN)
publish: blog
./blog -publish

.PHONY: today
today:
mkdir $(shell date '+%Y-%m-%d')

.PHONY: clean
clean:
rm -rf blog

0 comments on commit 0fb553a

Please sign in to comment.