Setting up Github Actions for Hugo
I setup Github Actions workflow for this blog to automate the publishing. Actions were new to me, this was a fun learning activity.
I had to write a new one because I could not find an existing action which filled my needs. Here is how it is setup:
My content, hugo config stays in the root of
master
branch and published site is at root ofgh-pages
.Every commit on
master
should trigger a publish and nonmaster
commits should be ignored. For them, I use netfliy deploy previews.Commits on
gh-pages
should preserve history. Some actions delete the existing history.Since every commit on
gh-pages
reflects a commit frommaster
, I wanted each of these commits to have the same commit message which triggered the build.
I have made this Github Action available here - hugo-publish