Skip to content

Commit 2b26ba2

Browse files
committed
Update hugo workflow to latest
Updated per: https://gohugo.io/host-and-deploy/host-on-github-pages/
1 parent ad29b10 commit 2b26ba2

1 file changed

Lines changed: 52 additions & 18 deletions

File tree

.github/workflows/hugo.yaml

Lines changed: 52 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Deploy Hugo site to Pages
1+
name: Build and Deploy Hugo Site to Pages
22

33
on:
44
push:
@@ -24,41 +24,75 @@ jobs:
2424
build:
2525
runs-on: ubuntu-latest
2626
env:
27-
HUGO_VERSION: 0.139.2
27+
# Latest versions as of 2025-10-14
28+
GO_VERSION: 1.25.3
29+
HUGO_VERSION: 0.151.0
30+
NODE_VERSION: 24.10.0
31+
TZ: America/Toronto
2832
steps:
29-
- name: Install Hugo CLI
30-
run: |
31-
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
32-
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
33-
- name: Install Dart Sass
34-
run: sudo snap install dart-sass
3533
- name: Checkout
36-
uses: actions/checkout@v4
34+
uses: actions/checkout@v5
3735
with:
3836
submodules: recursive
3937
fetch-depth: 0
38+
- name: Setup Go
39+
uses: actions/setup-go@v5
40+
with:
41+
go-version: ${{ env.GO_VERSION }}
42+
cache: false
43+
- name: Setup Node.js
44+
uses: actions/setup-node@v4
45+
with:
46+
node-version: ${{ env.NODE_VERSION }}
4047
- name: Setup Pages
4148
id: pages
4249
uses: actions/configure-pages@v5
50+
- name: Create directory for user-specific executable files
51+
run: |
52+
mkdir -p "${HOME}/.local"
53+
- name: Install Hugo
54+
run: |
55+
curl -sLJO "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
56+
mkdir "${HOME}/.local/hugo"
57+
tar -C "${HOME}/.local/hugo" -xf "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
58+
rm "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
59+
echo "${HOME}/.local/hugo" >> "${GITHUB_PATH}"
60+
- name: Verify installations
61+
run: |
62+
echo "Go: $(go version)"
63+
echo "Hugo: $(hugo version)"
64+
echo "Node.js: $(node --version)"
4365
- name: Install Node.js dependencies
4466
run: |
45-
cd marketing
4667
[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true
47-
- name: Build with Hugo
48-
env:
49-
HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
50-
HUGO_ENVIRONMENT: production
51-
TZ: America/Los_Angeles
68+
- name: Configure Git
69+
run: |
70+
git config core.quotepath false
71+
- name: Cache restore
72+
id: cache-restore
73+
uses: actions/cache/restore@v4
74+
with:
75+
path: ${{ runner.temp }}/hugo_cache
76+
key: hugo-${{ github.run_id }}
77+
restore-keys:
78+
hugo-
79+
- name: Build the site
5280
run: |
53-
cd marketing
5481
hugo \
5582
--gc \
5683
--minify \
57-
--baseURL "${{ steps.pages.outputs.base_url }}/"
84+
--baseURL "${{ steps.pages.outputs.base_url }}/" \
85+
--cacheDir "${{ runner.temp }}/hugo_cache"
86+
- name: Cache save
87+
id: cache-save
88+
uses: actions/cache/save@v4
89+
with:
90+
path: ${{ runner.temp }}/hugo_cache
91+
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
5892
- name: Upload artifact
5993
uses: actions/upload-pages-artifact@v3
6094
with:
61-
path: ./marketing/public
95+
path: ./public
6296

6397
# Deployment job
6498
deploy:

0 commit comments

Comments
 (0)