You Don't Need a Build System
I’ve deployed my website and the digital garden to Cloudflare pages and things are going great. However, the CI/CD pipeline was a mess until I settled on a simple system that just works.
At first, I tried to use Github Actions to build the Hugo site and deploy it, but it had its quirks. Then, I tried to used Cloudflare’s automatic build system, but it was messy.
I asked myself: “Why do we need a remote build system for a frontend site?”
I am already building the Hugo site locally, to review the changes that I am making. Why do I need to wait minutes for Github Actions or Cloudflare to create a container, set up the environment, and build the site?
The public directory already contains the files that need to be published,
so I had an idea to create a repository in it, but can I?
YES!
If you are building a Hugo site, and have a .gitignore file, you’ve probably have
public in it. The question now is, can I create a repository inside another repository,
if that repository ignores the repository that I am about to create?
YES!
The build system is now simple:
- Build the Hugo site locally.
- Change directory to
public. - Push changes.
Now Cloudflare will just have to clone the repo and publish it (it takes seconds).
Keep your pipeline simple :)
Bye-Bye!