I’m using GitHub Actions to deploy my Hugo website to GitHub Pages. I noticed that it changed output in the last 24 hours without code changes, so I dug into this more.
At first I was not able to duplicate the issue locally. Then I updated versions.
- Go
- Old:
1.15
- New:
1.17
- Old:
- Hugo
- Old:
v0.96.0+extended darwin/arm64 BuildDate=unknown
- New:
v0.97.1+extended darwin/arm64 BuildDate=unknown
- Old:
And I ran hugo mod clean --all
and reset my go
files to ensure my modules were up-to-date.
I am now able to duplicate the issue locally. Through many runs of this Bash command I have seen different outputs multiple times:
rm -rf ./public_old; cp -r ./public ./public_old; rm -rf ./public; hugo --quiet --minify; [ -d "./public/fonts" ] && echo "fonts/ directory exists"
Specifically, the majority of the time it’s not generating directories which belong to my theme and Twemoji module.
fonts/
icons/
twemoji/
About a 1 in 15 chance of the directories being created from my testing. Perhaps I’m not using hugo --minify
as intended? It came from the GitHub Actions docs.
# config.toml
...
disableKinds = ["taxonomy", "term"]
[module]
[[module.imports]]
disable = false
ignoreConfig = false
ignoreImports = false
path = "github.com/onweru/compose"
[[module.imports]]
disable = false
ignoreConfig = false
ignoreImports = false
path = "github.com/jakejarvis/hugo-mod-twemoji"
enableGitInfo = true
[outputs]
home = ["HTML", "RSS", "JSON"]
<!-- go.mod -->
module {my github repo}
go 1.17
require (
github.com/jakejarvis/hugo-mod-twemoji v0.3.0 // indirect
github.com/onweru/compose v0.0.0-20220410084245-65b76042967a // indirect
)
<!-- go.sum -->
github.com/jakejarvis/hugo-mod-twemoji v0.3.0 h1:jfd+zYe2EyQhc40FWNqK1x+/YbCefw6ZuMpUcDlSbcc=
github.com/jakejarvis/hugo-mod-twemoji v0.3.0/go.mod h1:3A+EjJ50vQEkmnEfhEY3RqPXozuWudsGwHx2UAUn9tA=
github.com/onweru/compose v0.0.0-20220410084245-65b76042967a h1:bsd3UpOPjyik/cPVvj5t8kVQCpXbDBPF9pkxkJqHINU=
github.com/onweru/compose v0.0.0-20220410084245-65b76042967a/go.mod h1:tf1kQIBUcwJ/3mRFU5eiMrMvsDScVTK2IEFsZE3hZOc=
github.com/twitter/twemoji v13.1.0+incompatible/go.mod h1:06L6PdKuWDx/Yh6s4B7yGkAeBmWZzbFZgfNnWlJPPYM=
# gh-pages.yml
...
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
extended: true
- name: Build with Hugo
run: hugo --minify
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
...