Building a Blog with Hugo and Deploying to Azure
Happy New Year 2025!
I recently started this blog because I get $150 in Azure credits every month from my company. I bought my domain from Namecheap.
Since I don’t enjoy front-end work and don’t want to use WordPress, I looked for a simple way to start blogging. I wanted to keep my source code on GitHub and use Markdown files. After some research, I found Hugo.
I followed this tutorial to build a Hugo site and deploy it to Azure Static Web Apps. The tutorial is great and covers many details.
However, I did one thing differently. The GitHub actions in the tutorial only uploads the public directory to Azure, which means we need to build/publish the site locally and then upload the public
directory to GitHub. I wanted GitHub Actions to handle the build process as well.
So, I added two more steps in GitHub Actions to set up Hugo and build the site. Here are the steps I added:
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.140.1'
- name: Build site
run: hugo --minify
Next, I added a custom domain oshinyil.com to Azure Static Web Apps by following this tutorial.
That’s all for today!
Cheers!