While many use static hosting, I built my own CI/CD pipeline. This is my first post from Hugo, and I’m excited to share the steps I followed to get things running.
Workflow Overview
The process is straightforward: code commits trigger the CI/CD pipeline, which builds and deploys the site. Here is a simplified view of the pipeline flow:
The Workflow:
- Code Changes: When I make edits to my website’s content or code in VS Code, those changes are committed directly to my Gitea source repository.
- Webhook Magic: The magic happens when a webhook is triggered by the commit on Gitea. This webhook sends a signal to a Docker webhook that acts as the orchestrator of my build process.
- Docker Containers Take Over: The Docker webhook spins up a Build Container: This container houses Hugo, our static site generator. It fetches the latest code from my Gitea repository and builds the website’s HTML files.
- Deployment to “Website” Repo: Once the build is successful, the newly generated website files are committed directly to another Gitea repository designated as “public”. This repository acts as the source for deployment to my web hosting provider.
- N8N deployment to host: Manual trigger to upload the website repo to the host. I did this in coding as the default N8N nodes (or my knowledge) were not capable enough.
Why this setup?
- Automation: The entire process is automated, ensuring my website is always up-to-date and ready to go.
- Version Control: Using Gitea provides version control for both my code and the built website files. This allows for easy rollbacks if something goes wrong. This custom CI/CD pipeline might seem a bit overkill for a simple blog, but I find it incredibly rewarding to have complete control over the process. Plus, it’s a great learning experience!
Conclusion
This is for testing purposes, let’s see where we go from here. The goal is to automate everything, and this is the first step. I’m looking forward to expanding the automation capabilities in the future.