This tutorial provides a step-by-step guide on how to automatically deploy a Hugo site to GitHub pages using GitHub Actions. The tutorial covers all the necessary steps, including committing the blog source to GitHub, enabling GitHub pages, and setting up GitHub Actions to automatically deploy the site. The tutorial also includes helpful tips and troubleshooting advice, making it a useful resource for anyone looking to automate the deployment of their Hugo site.
Table Of Contents
Step 0: Follow Hugo Quick Start
This post assumes you already followed the Hugo quick start guide, which you can find here.
Step 1: Commit Blog Source to Github
Create a new repository on Github here.
Push your local repository to Github
- Create and push a branch called
gh-pages- this is where the generated page will be deployed to.
Step 2: Enable Github Pages
- Go to your repository settings
- Navigate to the “Code and automation” section
- Click the “Pages” button
- Click the “Branch” button and select “gh-pages”
- Hit save
- Go to
https://YOUR_USERNAME/YOUR_REPONAME. You should see your README.
Step 3: Deploy Hugo Site with Github Actions
Put this file at
Commit the change.
Step 4: Verify Everything is Working
- Wait a few minutes
- Go to
https://YOUR_USERNAME/YOUR_REPONAME(or your custom domain)
- Your site should be there with new changes.
- Go into incognito mode or open a new browser if nothing has changed (it’s possible your browser is returning a cached result)