Skip to content

Commit 9bd8794

Browse files
committed
Update hugo site deployment workflow
1 parent 042ebfc commit 9bd8794

1 file changed

Lines changed: 62 additions & 20 deletions

File tree

.github/workflows/hugo.yaml

Lines changed: 62 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
name: Deploy Hugo site to Pages
1+
# Workflow referenced from: https://gohugo.io/host-and-deploy/host-on-github-pages/
2+
name: Deploy Hugo Site to Pages
23

34
on:
45
push:
@@ -19,48 +20,89 @@ concurrency:
1920
defaults:
2021
run:
2122
shell: bash
23+
working-directory: ./marketing
24+
25+
env:
26+
GO_VERSION: 1.25.3
27+
HUGO_VERSION: 0.152.2
28+
NODE_VERSION: 22.20.0
29+
TZ: America/Toronto
2230

2331
jobs:
2432
build:
2533
runs-on: ubuntu-latest
26-
env:
27-
HUGO_VERSION: 0.139.2
2834
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
3535
- name: Checkout
36-
uses: actions/checkout@v4
36+
uses: actions/checkout@v5
3737
with:
3838
submodules: recursive
3939
fetch-depth: 0
40+
- name: Setup Go
41+
uses: actions/setup-go@v5
42+
with:
43+
go-version: ${{ env.GO_VERSION }}
44+
cache: false
45+
- name: Setup Node.js
46+
uses: actions/setup-node@v4
47+
with:
48+
node-version: ${{ env.NODE_VERSION }}
4049
- name: Setup Pages
4150
id: pages
4251
uses: actions/configure-pages@v5
52+
- name: Create directory for user-specific executable files
53+
run: |
54+
mkdir -p "${HOME}/.local"
55+
- name: Install Dart Sass
56+
run: |
57+
curl -sLJO "https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz"
58+
tar -C "${HOME}/.local" -xf "dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz"
59+
rm "dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz"
60+
echo "${HOME}/.local/dart-sass" >> "${GITHUB_PATH}"
61+
- name: Install Hugo
62+
run: |
63+
curl -sLJO "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
64+
mkdir "${HOME}/.local/hugo"
65+
tar -C "${HOME}/.local/hugo" -xf "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
66+
rm "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
67+
echo "${HOME}/.local/hugo" >> "${GITHUB_PATH}"
68+
- name: Verify installations
69+
run: |
70+
echo "Dart Sass: $(sass --version)"
71+
echo "Go: $(go version)"
72+
echo "Hugo: $(hugo version)"
73+
echo "Node.js: $(node --version)"
4374
- name: Install Node.js dependencies
4475
run: |
45-
cd marketing
4676
[[ -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
77+
- name: Configure Git
78+
run: |
79+
git config core.quotepath false
80+
- name: Cache restore
81+
id: cache-restore
82+
uses: actions/cache/restore@v4
83+
with:
84+
path: ${{ runner.temp }}/hugo_cache
85+
key: hugo-${{ github.run_id }}
86+
restore-keys:
87+
hugo-
88+
- name: Build the site
5289
run: |
53-
cd marketing
5490
hugo \
5591
--gc \
5692
--minify \
57-
--baseURL "${{ steps.pages.outputs.base_url }}/"
93+
--baseURL "${{ steps.pages.outputs.base_url }}/" \
94+
--cacheDir "${{ runner.temp }}/hugo_cache"
95+
- name: Cache save
96+
id: cache-save
97+
uses: actions/cache/save@v4
98+
with:
99+
path: ${{ runner.temp }}/hugo_cache
100+
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
58101
- name: Upload artifact
59102
uses: actions/upload-pages-artifact@v3
60103
with:
61-
path: ./marketing/public
104+
path: ./public
62105

63-
# Deployment job
64106
deploy:
65107
environment:
66108
name: github-pages

0 commit comments

Comments
 (0)