pages := $(shell find . -type f -name '*.adoc') web_dir := ./_public # Determine whether to use podman # # podman currently fails when executing in GitHub actions on Ubuntu LTS 20.04, # so we never use podman if GITHUB_ACTIONS==true. use_podman := $(shell command -v podman 2>&1 >/dev/null; p="$$?"; \ if [ "$${GITHUB_ACTIONS}" != "true" ]; then echo "$$p"; else echo 1; fi) ifeq ($(use_podman),0) engine_cmd ?= podman engine_opts ?= --rm --tty --userns=keep-id else engine_cmd ?= docker engine_opts ?= --rm --tty --user "$$(id -u)" endif # renovate: datasource=github-releases depName=vshn/antora antora_VERSION ?= 3.1.2.3 antora_cmd ?= $(engine_cmd) run $(engine_opts) --volume "$${PWD}":/antora ghcr.io/vshn/antora:$(antora_VERSION) # renovate: datasource=github-releases depName=vshn/antora-preview preview_VERSION ?= 3.1.2.3 antora_opts ?= --cache-dir=.cache/antora preview_cmd ?= $(engine_cmd) run --rm --publish 35729:35729 --publish 2020:2020 --volume "${PWD}":/preview/antora ghcr.io/vshn/antora-preview:$(preview_VERSION) --antora=docs --style=vshn UNAME := $(shell uname) ifeq ($(UNAME), Linux) OS = linux-x64 OPEN = xdg-open endif ifeq ($(UNAME), Darwin) OS = darwin-x64 OPEN = open endif .PHONY: docs-clean clean: rm -rf $(web_dir) .cache .PHONY: docs-open docs-open: $(web_dir)/index.html -$(OPEN) $< .PHONY: docs-html docs-html: $(web_dir)/index.html .PHONY: docs-preview docs-preview: $(preview_cmd) $(web_dir)/index.html: playbook.yml $(pages) $(antora_cmd) $(antora_opts) $<