Skip to content

Commit 9acf399

Browse files
committed
feat_enable_version_specific_docs
1 parent 2b0e6db commit 9acf399

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

docs/Makefile

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,25 @@
1919
# Minimal makefile for Sphinx documentation
2020
#
2121

22-
# You can set these variables from the command line, and also
23-
# from the environment for the first two.
2422
SPHINXOPTS ?=
2523
SPHINXBUILD ?= sphinx-build
2624
SOURCEDIR = source
2725
BUILDDIR = build
2826

29-
# Put it first so that "make" without argument is like "make help".
27+
# Extract version from Cargo.toml (default)
28+
PROJECT_VERSION := $(shell grep '^version' ../native/Cargo.toml | head -1 | cut -d '"' -f2)
29+
3030
help:
3131
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
3232

33-
.PHONY: help Makefile
33+
html:
34+
@echo "Building docs for version $(PROJECT_VERSION)"
35+
@PROJECT_VERSION=$(PROJECT_VERSION) $(SPHINXBUILD) -b html "$(SOURCEDIR)" "$(BUILDDIR)/html"
3436

35-
# Catch-all target: route all unknown targets to Sphinx using the new
36-
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
37-
%: Makefile
38-
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
37+
# Build docs and copy into versioned dir (like Spark does)
38+
publish: html
39+
@mkdir -p site/docs/$(PROJECT_VERSION)
40+
@cp -r $(BUILDDIR)/html/* site/docs/$(PROJECT_VERSION)/
41+
@rm -rf site/docs/latest
42+
@ln -s $(PROJECT_VERSION) site/docs/latest
43+
@echo "Docs published under site/docs/$(PROJECT_VERSION) and site/docs/latest"

0 commit comments

Comments
 (0)