Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hugo version check and theme update to Makefile #883

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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')
Loading