Skip to content

Commit a438e33

Browse files
nginx-jacksalonichf5
authored andcommitted
Add hugo version check and theme update to Makefile (#2608)
Update README.md with correct make target behaviors Add hugo-entrypoint to allow extra commands when docker starts Update hugo theme version in go.mod Use slimmer hugo docker image
1 parent b1b90fd commit a438e33

File tree

4 files changed

+24
-15
lines changed

4 files changed

+24
-15
lines changed

site/Makefile

+15-14
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,41 @@
11
HUGO?=hugo
2-
HUGO_IMG?=hugomods/hugo:0.115.3
2+
HUGO_VERSION?=$(shell hugo version 2>/dev/null | awk '{print $$2}' | cut -d '.' -f 2)
3+
HUGO_IMG?=hugomods/hugo:std-go-git-0.134.3
34

45
THEME_MODULE = github.com/nginxinc/nginx-hugo-theme
5-
THEME_VERSION = 0.41.14
66

7-
ifeq (, $(shell ${HUGO} version 2> /dev/null))
8-
ifeq (, $(shell docker version 2> /dev/null))
9-
$(error Docker and Hugo are not installed. Hugo (<0.91) or Docker are required to build the local preview.)
7+
ifeq ($(shell [ $(HUGO_VERSION) -gt 133 2>/dev/null ] && echo true || echo false), true)
8+
$(info Hugo is available and has a version greater than 133. Proceeding with build.)
109
else
11-
HUGO=docker run --rm -it -v ${CURDIR}:/src -p 1313:1313 ${HUGO_IMG} hugo --bind 0.0.0.0 -p 1313
12-
endif
10+
$(warning Hugo is not available or using a version less than 134. Attempting to use docker. HUGO_VERSION=$(HUGO_VERSION))
11+
HUGO=docker run --rm -it -v ${CURDIR}:/src -p 1313:1313 ${HUGO_IMG} /src/hugo-entrypoint.sh
12+
ifeq (, $(shell docker version 2> /dev/null))
13+
$(error Hugo (>0.134) or Docker are required to build the local previews.)
14+
endif
1315
endif
1416

1517
MARKDOWNLINT?=markdownlint
1618
MARKDOWNLINT_IMG?=ghcr.io/igorshubovych/markdownlint-cli:latest
1719

1820
ifeq (, $(shell ${MARKDOWNLINT} version 2> /dev/null))
1921
ifeq (, $(shell docker version 2> /dev/null))
20-
$(error Docker and markdownlint are not installed. markdownlint or Docker are required to lint.)
21-
endif
2222
else
2323
MARKDOWNLINT=docker run --rm -i -v ${CURDIR}:/src --workdir /src ${MARKDOWNLINT_IMG}
2424
endif
25+
endif
2526

2627
MARKDOWNLINKCHECK?=markdown-link-check
2728
MARKDOWNLINKCHECK_IMG?=ghcr.io/tcort/markdown-link-check:stable
2829

2930
ifeq (, $(shell ${MARKDOWNLINKCHECK} --version 2> /dev/null))
3031
ifeq (, $(shell docker version 2> /dev/null))
31-
$(error Docker and markdown-link-check are not installed. markdown-link-check or Docker are required to check links.)
32-
endif
3332
else
34-
MARKDOWNLINKCHECK=docker run --rm -it -v ${CURDIR}:/site --workdir /site ${MARKDOWNLINKCHECK_IMG}
33+
MARKDOWNLINKCHECK=docker run --rm -it -v ${CURDIR}:/docs --workdir /docs ${MARKDOWNLINKCHECK_IMG}
34+
endif
3535
endif
3636

37-
.PHONY: docs watch drafts clean hugo-get hugo-tidy hugo-update lint-markdown link-check
37+
38+
.PHONY: docs docs-draft docs-local clean hugo-get hugo-tidy lint-markdown link-check
3839

3940
docs:
4041
${HUGO}
@@ -49,7 +50,7 @@ clean:
4950
[ -d "public" ] && rm -rf "public"
5051

5152
hugo-get:
52-
hugo mod get $(THEME_MODULE)@v$(THEME_VERSION)
53+
hugo mod get -u github.com/nginxinc/nginx-hugo-theme
5354

5455
hugo-tidy:
5556
hugo mod tidy

site/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ module github.com/nginxinc/nginx-gateway-fabric/site
22

33
go 1.21
44

5-
require github.com/nginxinc/nginx-hugo-theme v0.41.14 // indirect
5+
require github.com/nginxinc/nginx-hugo-theme v0.41.19 // indirect

site/go.sum

+4
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
github.com/nginxinc/nginx-hugo-theme v0.41.14 h1:OraNB01CdMJXufPddvIVt6qn6Mj38Z/XCVIWBgVtuY0=
22
github.com/nginxinc/nginx-hugo-theme v0.41.14/go.mod h1:DPNgSS5QYxkjH/BfH4uPDiTfODqWJ50NKZdorguom8M=
3+
github.com/nginxinc/nginx-hugo-theme v0.41.18 h1:4weO2h6L56lebyX7G+iqHd481RCXQQParhb1lARwdLQ=
4+
github.com/nginxinc/nginx-hugo-theme v0.41.18/go.mod h1:DPNgSS5QYxkjH/BfH4uPDiTfODqWJ50NKZdorguom8M=
5+
github.com/nginxinc/nginx-hugo-theme v0.41.19 h1:CyZOhU8q0p3nQ+ZTFRx7c/Dq9rxV1mShADIHz0vDoHo=
6+
github.com/nginxinc/nginx-hugo-theme v0.41.19/go.mod h1:DPNgSS5QYxkjH/BfH4uPDiTfODqWJ50NKZdorguom8M=

site/hugo-entrypoint.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
hugo mod get -u github.com/nginxinc/nginx-hugo-theme
4+
hugo $*

0 commit comments

Comments
 (0)