This is a small write up about setting up GitHub Actions to deploy Hugo site.
Table of content
How I was deploying it earlier?
I used to have 2 commits for any changes.
- Changes to the posts
- HTML documents generated through
hugo
command
What was the problem there?
The major problem is the process involves 2 steps. Sometimes, I used to forget generating HTML docs and the changes never flow into the static site.
Also, the too many commits results in addition of noise to the commit history.
How does the GitHub Actions helps us here?
We are using 2 repositories - one with the actual hugo file structure and another one to have html files
- We commit our changes to the 1st repo.
- This has a GH Action set up to generate documents.
- The generated documents are loaded into 2nd repo.
Additionally, we can keep the 1st as private, so the core of the static site stays away from the public view.
Please refer to the article in ruddra.com.
In the main.yml
file, under deploy section publish_dir
must point to the publishDir in config.toml
Page source
Page last updated on: 2024-11-06 09:30:05 +0530 +0530Git commit: a98b4d9