mirror of
https://github.com/peaceiris/actions-hugo.git
synced 2025-06-18 01:55:29 +08:00
Compare commits
3 Commits
06b8f1de11
...
ce1c523b1d
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ce1c523b1d | ||
![]() |
288264f9c9 | ||
![]() |
f6d0e78500 |
3
Makefile
3
Makefile
@ -2,14 +2,13 @@ cmd := "bash"
|
|||||||
msg := ""
|
msg := ""
|
||||||
IMAGE_NAME := actions_hugo_dev:latest
|
IMAGE_NAME := actions_hugo_dev:latest
|
||||||
NODE_VERSION := $(shell cat ./.nvmrc)
|
NODE_VERSION := $(shell cat ./.nvmrc)
|
||||||
DOCKER_BUILD := docker build . -t $(IMAGE_NAME) --build-arg NODE_VERSION=$(NODE_VERSION)
|
|
||||||
DOCKER_RUN := docker run --rm -i -t -v ${PWD}:/repo -v ~/.gitconfig:/root/.gitconfig $(IMAGE_NAME)
|
DOCKER_RUN := docker run --rm -i -t -v ${PWD}:/repo -v ~/.gitconfig:/root/.gitconfig $(IMAGE_NAME)
|
||||||
DOCKER_RUN_CI := docker run --rm -v ${PWD}:/repo $(IMAGE_NAME)
|
DOCKER_RUN_CI := docker run --rm -v ${PWD}:/repo $(IMAGE_NAME)
|
||||||
|
|
||||||
|
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
build:
|
build:
|
||||||
$(DOCKER_BUILD)
|
docker build . -t $(IMAGE_NAME) --build-arg NODE_VERSION=$(NODE_VERSION)
|
||||||
|
|
||||||
.PHONY: run
|
.PHONY: run
|
||||||
run:
|
run:
|
||||||
|
20
README.md
20
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-
|
||||||
|
16
docker-compose.yml
Normal file
16
docker-compose.yml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
version: '3.2'
|
||||||
|
|
||||||
|
services:
|
||||||
|
dev:
|
||||||
|
image: 'docker.pkg.github.com/peaceiris/actions-hugo/dev:latest'
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
# cache_from:
|
||||||
|
# - 'docker.pkg.github.com/peaceiris/actions-hugo/dev:latest'
|
||||||
|
container_name: peaceiris_actions_hugo_dev_latest
|
||||||
|
volumes:
|
||||||
|
- ${PWD}:/repo
|
||||||
|
stdin_open: true
|
||||||
|
tty: true
|
||||||
|
command:
|
||||||
|
- bash
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -6,7 +6,7 @@
|
|||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "actions-hugo",
|
"name": "actions-hugo",
|
||||||
"version": "2.6.0",
|
"version": "3.0.0",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
Loading…
Reference in New Issue
Block a user