docs: Add Caching Hugo Modules

This commit is contained in:
peaceiris 2020-10-01 04:26:48 +09:00
parent 4245d14847
commit 18a809e6c9
No known key found for this signature in database
GPG Key ID: 5868468A8EBA64EC
1 changed files with 18 additions and 0 deletions

View File

@ -47,6 +47,7 @@ Thanks to this change, we can complete this action in less than a few seconds.
- [⭐️ Use Hugo extended](#%EF%B8%8F-use-hugo-extended)
- [⭐️ Use the latest version of Hugo](#%EF%B8%8F-use-the-latest-version-of-hugo)
- [Tips](#tips)
- [⭐️ Caching Hugo Modules](#%EF%B8%8F-caching-hugo-modules)
- [⭐️ Read Hugo version from file](#%EF%B8%8F-read-hugo-version-from-file)
- [⭐️ Workflow for autoprefixer and postcss-cli](#%EF%B8%8F-workflow-for-autoprefixer-and-postcss-cli)
- [⭐️ Workflow for asciidoctor](#%EF%B8%8F-workflow-for-asciidoctor)
@ -144,6 +145,23 @@ This action fetches the latest version of Hugo by [hugo | Homebrew Formulae](htt
## Tips
### ⭐️ Caching Hugo Modules
Insert a cache step before site-building as follows.
Note that the cache dir location of Hugo on a Linux-based operating system is `/tmp/hugo_cache`. On macOS, `${TMPDIR}/hugo_cache` has the location.
```yaml
- uses: actions/cache@v2
with:
path: /tmp/hugo_cache
key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-hugomod-
- name: Build
run: hugo --minify
```
### ⭐️ Read Hugo version from file
How to sync a Hugo version between a Docker Compose and a GitHub Actions workflow via `.env` file.