mirror of
https://github.com/peaceiris/actions-hugo.git
synced 2025-06-18 10:05:28 +08:00
Compare commits
3 Commits
58f74befcf
...
e52328f622
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e52328f622 | ||
![]() |
f2109f1312 | ||
![]() |
288264f9c9 |
3
.github/workflows/test.yml
vendored
3
.github/workflows/test.yml
vendored
@ -24,8 +24,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Node
|
- uses: actions/setup-node@v4
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
|
23
README.md
23
README.md
@ -151,13 +151,27 @@ This action fetches the latest version of Hugo by [hugo | Homebrew Formulae](htt
|
|||||||
### ⭐️ Caching Hugo Modules
|
### ⭐️ Caching Hugo Modules
|
||||||
|
|
||||||
Insert a cache step before site-building as follows.
|
Insert a cache step before site-building as follows.
|
||||||
Note that with latest hugo version, the [cache dir location](https://gohugo.io/getting-started/configuration/#configure-cachedir) on a Linux-based operating system is `${HOME}/.cache`. On macOS, `${HOME}/Library/Caches` has the location.
|
|
||||||
|
First, to maximize compatibility with all Hugo versions, let's define the variable `HUGO_CACHEDIR`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# * ...
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
env:
|
||||||
|
HUGO_CACHEDIR: /tmp/hugo_cache # <- Define the env variable here, so that Hugo's cache dir is now predictible in your workflow and doesn't depend on the Hugo's version you're using.
|
||||||
|
|
||||||
|
# * ...
|
||||||
|
```
|
||||||
|
|
||||||
|
Now, let's add the cache action call just above the _Build_ step:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/cache@v4
|
- uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: /home/runner/.cache/hugo_cache # <-- with hugo version v0.116.0 and above
|
path: ${{ env.HUGO_CACHEDIR }} # <- Use the same env variable just right here
|
||||||
# path: /tmp/hugo_cache # <-- with hugo version < v0.116.0
|
|
||||||
key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.sum') }}
|
key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.sum') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-hugomod-
|
${{ runner.os }}-hugomod-
|
||||||
@ -261,8 +275,7 @@ jobs:
|
|||||||
hugo-version: '0.119.0'
|
hugo-version: '0.119.0'
|
||||||
extended: true
|
extended: true
|
||||||
|
|
||||||
- name: Setup Node
|
- uses: actions/setup-node@v4
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
with:
|
||||||
node-version: '20'
|
node-version: '20'
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
|
13240
package-lock.json
generated
13240
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user