Skip to content

Commit 5a6d593

Browse files
committed
Update makefile to use docs-builder
Signed-off-by: bmorelli25 <brandon.morelli@elastic.co>
1 parent de68ec5 commit 5a6d593

1 file changed

Lines changed: 44 additions & 4 deletions

File tree

Makefile

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,53 @@ check_license_headers:
4141
clean:
4242
rm -rf build generated/elasticsearch/composable/component experimental/generated/elasticsearch/composable/component
4343

44-
# Build the asciidoc book.
44+
# Build and serve the docs
4545
.PHONY: docs
4646
docs:
47-
if [ ! -d $(PWD)/build/docs ]; then \
48-
git clone --depth=1 https://github.com/elastic/docs.git ./build/docs ; \
47+
@echo "Building documentation with docs-builder..."
48+
@mkdir -p $(PWD)/build/docs
49+
@if [ ! -f "$(PWD)/build/docs/docs-builder" ] && [ ! -f "$(PWD)/build/docs/docs-builder.exe" ]; then \
50+
echo "Downloading docs-builder..."; \
51+
OS=$$(uname -s 2>/dev/null || echo "Windows_NT"); \
52+
cd $(PWD)/build/docs && \
53+
if [ "$$OS" = "Darwin" ]; then \
54+
ARCH=$$(uname -m); \
55+
if [ "$$ARCH" = "arm64" ]; then \
56+
echo "Detected macOS on ARM64"; \
57+
curl -LO https://github.com/elastic/docs-builder/releases/latest/download/docs-builder-mac-arm64.zip; \
58+
ZIPFILE="docs-builder-mac-arm64.zip"; \
59+
else \
60+
echo "Detected macOS on x86_64"; \
61+
curl -LO https://github.com/elastic/docs-builder/releases/latest/download/docs-builder-mac-x86_64.zip; \
62+
ZIPFILE="docs-builder-mac-x86_64.zip"; \
63+
fi; \
64+
elif [ "$$OS" = "Linux" ]; then \
65+
echo "Detected Linux"; \
66+
curl -LO https://github.com/elastic/docs-builder/releases/latest/download/docs-builder-linux-x86_64.zip; \
67+
ZIPFILE="docs-builder-linux-x86_64.zip"; \
68+
elif echo "$$OS" | grep -q "Windows"; then \
69+
echo "Detected Windows"; \
70+
curl -LO https://github.com/elastic/docs-builder/releases/latest/download/docs-builder-windows-x86_64.zip; \
71+
ZIPFILE="docs-builder-windows-x86_64.zip"; \
72+
else \
73+
echo "Unsupported platform: $$OS"; \
74+
exit 1; \
75+
fi && \
76+
unzip -o $$ZIPFILE && \
77+
rm $$ZIPFILE && \
78+
if echo "$$OS" | grep -q "Windows"; then \
79+
chmod +x docs-builder.exe 2>/dev/null || true; \
80+
else \
81+
chmod +x docs-builder; \
82+
fi; \
83+
fi
84+
@echo "Running docs-builder to serve documentation..."
85+
@cd $(PWD) && \
86+
if [ -f "$(PWD)/build/docs/docs-builder.exe" ]; then \
87+
$(PWD)/build/docs/docs-builder.exe serve; \
88+
else \
89+
$(PWD)/build/docs/docs-builder serve; \
4990
fi
50-
./build/docs/build_docs --asciidoctor --doc ./docs/index.asciidoc --chunk=2 $(OPEN_DOCS) --out ./build/html_docs
5191

5292
# Alias to generate experimental artifacts
5393
.PHONY: experimental

0 commit comments

Comments
 (0)