Azure Static Web Apps is a fantastic service that brings together hosting, serverless APIs, and CI/CD in one package. If you’re building a personal site, a documentation portal, or a Jamstack app, it’s hard to beat the developer experience.
Why Azure Static Web Apps?
Here are my top reasons for choosing it:
- Free tier – perfect for personal projects and blogs
- Built-in CI/CD via GitHub Actions
- Global CDN distribution out of the box
- Custom domains with automatic HTTPS
- Preview environments for every pull request
Setting Up Your Hugo Site
First, make sure you have Hugo installed locally. You can grab the latest release from the Hugo releases page.
# Create a new Hugo site
hugo new site my-site
# Navigate into it
cd my-site
# Add a theme
hugo new theme my-theme
Deploying with GitHub Actions
The Azure Static Web Apps GitHub Action handles everything for you. After creating a Static Web App resource in the Azure portal, it will automatically add a workflow file to your repository.
- name: Build And Deploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: "upload"
app_location: "/"
output_location: "public"
Conclusion
Azure Static Web Apps combined with Hugo gives you a blazing-fast, globally distributed site with zero server management. Give it a try!