Skip to content

Commit 22e60e5

Browse files
committed
Update Actions workflow
1 parent 76f0ab7 commit 22e60e5

1 file changed

Lines changed: 35 additions & 12 deletions

File tree

.github/workflows/hugo.yaml

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,41 +25,64 @@ concurrency:
2525
# Default to bash
2626
defaults:
2727
run:
28+
# GitHub-hosted runners automatically enable `set -eo pipefail` for Bash shells.
2829
shell: bash
2930

3031
jobs:
3132
# Build job
3233
build:
3334
runs-on: ubuntu-latest
3435
env:
36+
DART_SASS_VERSION: 1.89.2
3537
HUGO_VERSION: 0.111.3
38+
HUGO_ENVIRONMENT: production
39+
TZ: America/Los_Angeles
3640
steps:
3741
- name: Install Hugo CLI
3842
run: |
39-
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
40-
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
41-
- name: Install Dart Sass Embedded
42-
run: sudo snap install dart-sass-embedded
43+
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb
44+
sudo dpkg -i ${{ runner.temp }}/hugo.deb
45+
- name: Install Dart Sass
46+
run: |
47+
wget -O ${{ runner.temp }}/dart-sass.tar.gz https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz
48+
tar -xf ${{ runner.temp }}/dart-sass.tar.gz --directory ${{ runner.temp }}
49+
mv ${{ runner.temp }}/dart-sass/ /usr/local/bin
50+
echo "/usr/local/bin/dart-sass" >> $GITHUB_PATH
4351
- name: Checkout
44-
uses: actions/checkout@v3
52+
uses: actions/checkout@v4
4553
with:
4654
submodules: recursive
4755
fetch-depth: 0
4856
- name: Setup Pages
4957
id: pages
50-
uses: actions/configure-pages@v3
58+
uses: actions/configure-pages@v5
5159
- name: Install Node.js dependencies
5260
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
61+
- name: Cache Restore
62+
id: cache-restore
63+
uses: actions/cache/restore@v4
64+
with:
65+
path: |
66+
${{ runner.temp }}/hugo_cache
67+
key: hugo-${{ github.run_id }}
68+
restore-keys:
69+
hugo-
70+
- name: Configure Git
71+
run: git config core.quotepath false
5372
- name: Build with Hugo
54-
env:
55-
# For maximum backward compatibility with Hugo modules
56-
HUGO_ENVIRONMENT: production
57-
HUGO_ENV: production
5873
run: |
5974
hugo \
6075
--gc \
6176
--minify \
62-
--baseURL "${{ steps.pages.outputs.base_url }}/"
77+
--baseURL "${{ steps.pages.outputs.base_url }}/" \
78+
--cacheDir "${{ runner.temp }}/hugo_cache"
79+
- name: Cache Save
80+
id: cache-save
81+
uses: actions/cache/save@v4
82+
with:
83+
path: |
84+
${{ runner.temp }}/hugo_cache
85+
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
6386
- name: Upload artifact
6487
uses: actions/upload-pages-artifact@v3
6588
with:
@@ -75,4 +98,4 @@ jobs:
7598
steps:
7699
- name: Deploy to GitHub Pages
77100
id: deployment
78-
uses: actions/deploy-pages@v2
101+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)