Skip to content

Commit 4200999

Browse files
committed
fix workflow
1 parent 8c3132b commit 4200999

1 file changed

Lines changed: 33 additions & 7 deletions

File tree

.github/workflows/hugo.yml

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ name: Deploy Hugo site to Pages
44
on:
55
# Runs on pushes targeting the default branch
66
push:
7-
branches: ["main"]
7+
branches:
8+
- main
89

910
# Allows you to run this workflow manually from the Actions tab
1011
workflow_dispatch:
@@ -31,28 +32,53 @@ jobs:
3132
build:
3233
runs-on: ubuntu-latest
3334
env:
34-
HUGO_VERSION: 0.123.7
35+
HUGO_VERSION: 0.147.6
36+
HUGO_ENVIRONMENT: production
37+
TZ: America/Los_Angeles
3538
steps:
3639
- name: Install Hugo CLI
37-
run: sudo snap install hugo
40+
run: |
41+
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
42+
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
3843
- name: Install Dart Sass
3944
run: sudo snap install dart-sass
4045
- name: Checkout
4146
uses: actions/checkout@v4
4247
with:
4348
submodules: recursive
49+
fetch-depth: 0
4450
- name: Setup Pages
4551
id: pages
46-
uses: actions/configure-pages@v4
52+
uses: actions/configure-pages@v5
4753
- name: Install Node.js dependencies
4854
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
55+
- name: Cache Restore
56+
id: cache-restore
57+
uses: actions/cache/restore@v4
58+
with:
59+
path: |
60+
${{ runner.temp }}/hugo_cache
61+
key: hugo-${{ github.run_id }}
62+
restore-keys:
63+
hugo-
64+
- name: Configure Git
65+
run: git config core.quotepath false
4966
- name: Build with Hugo
5067
run: |
5168
hugo \
69+
--gc \
5270
--minify \
53-
--baseURL "${{ steps.pages.outputs.base_url }}/"
71+
--baseURL "${{ steps.pages.outputs.base_url }}/" \
72+
--cacheDir "${{ runner.temp }}/hugo_cache"
73+
- name: Cache Save
74+
id: cache-save
75+
uses: actions/cache/save@v4
76+
with:
77+
path: |
78+
${{ runner.temp }}/hugo_cache
79+
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
5480
- name: Upload artifact
55-
uses: actions/upload-artifact@v2
81+
uses: actions/upload-pages-artifact@v3
5682
with:
5783
path: ./public
5884

@@ -66,4 +92,4 @@ jobs:
6692
steps:
6793
- name: Deploy to GitHub Pages
6894
id: deployment
69-
uses: actions/deploy-pages@v3
95+
uses: actions/deploy-pages@v4 uses: actions/deploy-pages@v3

0 commit comments

Comments
 (0)