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
masterbranch and published site is at root ofgh-pages.Every commit on
mastershould trigger a publish and nonmastercommits should be ignored. For them, I use netfliy deploy previews.Commits on
gh-pagesshould preserve history. Some actions delete the existing history.Since every commit on
gh-pagesreflects 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