The blogging flow provided by ox-hugo suggests that Markdown files should be committed to the source repository along with the Org file. I'm reluctant to do that because the Markdown files are effectively a build artefact in this flow. I also couldn't find any information on how to integrate ox-hugo's export functionality with a continuous integration service.
Fortunately, it's quite simple to do with GitHub Actions. After following the instructions for the hugo-setup Action (these at the time of writing), we must then export the Org file as part of the workflow. set-up-emacs will install emacs and Org. ox-hugo must be cloned separately. Add a step to the job:
- name: Clone Org-mode exporter run: git clone https://github.com/kaushalmodi/ox-hugo.git ox-hugo
Then add another step to call the export function:
- name: Export Org file to Markdown run: emacs ./posts.org --batch -L ./ox-hugo -l ox-hugo.el --eval='(org-hugo-export-wim-to-md t)' --kill
This is assuming that the Org file containing the posts is
located in the root of the repository. This will export all applicable
subtrees. The first argument to
org-hugo-export-wim-to-md controls that
That's it! You can view my workflow file to see how it looked just after this change was made.