From 18a809e6c96de4cb534ad52f31dfe28ef32bd7d5 Mon Sep 17 00:00:00 2001 From: peaceiris <30958501+peaceiris@users.noreply.github.com> Date: Thu, 1 Oct 2020 04:26:48 +0900 Subject: [PATCH] docs: Add Caching Hugo Modules --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index 8c420cf..036ec26 100644 --- a/README.md +++ b/README.md @@ -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.