A bit of blog metawork
The last couple weeks had too much going on for me to keep the daily post schedule regardless, but I think I can make things a little more frequent by reducing posting friction. To that effect, baby’s first elisp:
;; open blog source file
(find-file "~/org/sites/dfnet-blog.org")
;; save file
(save-buffer)
;; use magit to stage changes
(magit-status)
(magit-stage-file "~/org/sites/dfnet-blog.org")
;; actually do the commit by shelling out to git
(shell-command "git commit -m 'update blog'")
;; use ox-hugo WIM to export full tree to markdown...maybe
;; it seems to have issues with image prefixes?
;; (org-hugo-export-wim-to-md :all-subtrees nil)
;; change directory to ~/sites/dylanfitzgerald.net/
(cd "~/sites/dylanfitzgerald.net/")
;; build hugo site
(shell-command "hugo --gc --minify --enableGitInfo")
;; stage, commit, push
(magit-status)
(magit-stage-modified :all)
(shell-command "git commit -m 'update blog'")
(shell-command "git push")
(magit-status)
;; build docker image
(shell-command "docker build -t arubis/dfnet:latest . --push")
;; reload image into k8s
(shell-command "kubectl rollout restart deployment/dfnet-blog-www-app")
;; clean up? want logic to do this only if it wasn't open already
;; (kill-buffer "dfnet-blog.org")
It works? The real trick is to stop myself fiddling further before I whittle away the gains I’d get from this automation.
Overall, I’m going to start emphasizing less hands work and more head work here as I get more deliberate in my audience selection. I hope you’ll be there!