As per my Hello Again post I’m looking at automating some of my content creation.
The current state of play
If you’ve looked before, you’ll know I use Hugo to build my site.
That means I need to ask Hugo to build my site whenever I add some more content, which currently means:
- Get Hugo to build the content
- Update my git repo with the new content
- Push the repo to GitHub
- GitHub fires a webhook that tells my site to pull down new content
Don’t shoot me, this was all build pre-workflow days.
Have a workflow to do all of the above for me
Get it to build and just fire the current webhook.
Wish me luck with it.
Fail. I forgot my repo is so old that it was stil called master and not main, and I’d put main in my workflow action.
Fail. A few gotchas it seems with the examples given online for running Hugo builds as workflows. I needed to add:
To my workflow file for it to be able to pull down the docker image.
Fail-ish. Ooops, only had it build an artefact to attach to the build, not actually commit the public directory back to the repo.
Success-ish. All built and committed back to the repo, but for some reason my webhook for deploy is failing :/
Success! Although I really need to commit to a different repo to avoid having to do a git pull after every git push.