Skip to content

Commit

Permalink
Merge pull request #883 from nginx/cherry-pick-v3-documentation-7087d…
Browse files Browse the repository at this point in the history
…e1f30b3910b2991f8c8b6b51588752aeb46

Add hugo version check and theme update to Makefile
  • Loading branch information
ADubhlaoich authored Oct 2, 2024
2 parents 8ae30fc + ffa9ca2 commit 9c782ae
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 4 deletions.
4 changes: 2 additions & 2 deletions site/go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module github.com/nginx/agent/site

go 1.18
go 1.22.0

require github.com/nginxinc/nginx-hugo-theme v0.41.14 // indirect
require github.com/nginxinc/nginx-hugo-theme v0.41.19 // indirect
4 changes: 2 additions & 2 deletions site/go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github.com/nginxinc/nginx-hugo-theme v0.41.14 h1:OraNB01CdMJXufPddvIVt6qn6Mj38Z/XCVIWBgVtuY0=
github.com/nginxinc/nginx-hugo-theme v0.41.14/go.mod h1:DPNgSS5QYxkjH/BfH4uPDiTfODqWJ50NKZdorguom8M=
github.com/nginxinc/nginx-hugo-theme v0.41.19 h1:CyZOhU8q0p3nQ+ZTFRx7c/Dq9rxV1mShADIHz0vDoHo=
github.com/nginxinc/nginx-hugo-theme v0.41.19/go.mod h1:DPNgSS5QYxkjH/BfH4uPDiTfODqWJ50NKZdorguom8M=
4 changes: 4 additions & 0 deletions site/hugo-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

hugo mod get -u github.com/nginxinc/nginx-hugo-theme
hugo $*
64 changes: 64 additions & 0 deletions site/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
HUGO?=hugo
HUGO_VERSION?=$(shell hugo version 2>/dev/null | awk '{print $$2}' | cut -d '.' -f 2)
HUGO_IMG?=hugomods/hugo:std-go-git-0.134.3

THEME_MODULE = github.com/nginxinc/nginx-hugo-theme

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

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

ifeq (, $(shell ${MARKDOWNLINT} version 2> /dev/null))
ifeq (, $(shell docker version 2> /dev/null))
else
MARKDOWNLINT=docker run --rm -i -v ${CURDIR}:/src --workdir /src ${MARKDOWNLINT_IMG}
endif
endif

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

ifeq (, $(shell ${MARKDOWNLINKCHECK} --version 2> /dev/null))
ifeq (, $(shell docker version 2> /dev/null))
else
MARKDOWNLINKCHECK=docker run --rm -it -v ${CURDIR}:/docs --workdir /docs ${MARKDOWNLINKCHECK_IMG}
endif
endif


.PHONY: docs docs-draft docs-local clean hugo-get hugo-tidy lint-markdown link-check

docs:
${HUGO}

watch:
${HUGO} --bind 0.0.0.0 -p 1313 server --disableFastRender

drafts:
${HUGO} --bind 0.0.0.0 -p 1313 server -D --disableFastRender

clean:
[ -d "public" ] && rm -rf "public"

hugo-get:
hugo mod get -u github.com/nginxinc/nginx-hugo-theme

hugo-tidy:
hugo mod tidy

hugo-update: hugo-get hugo-tidy

lint-markdown:
${MARKDOWNLINT} -c .markdownlint.yaml -- content

link-check:
${MARKDOWNLINKCHECK} $(shell find content -name '*.md')

0 comments on commit 9c782ae

Please sign in to comment.