-
Notifications
You must be signed in to change notification settings - Fork 234
/
Makefile
63 lines (49 loc) · 1.87 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# See: https://www.mkdocs.org/user-guide/deploying-your-docs/
# Running 'make' uses poetry-installed mkdocs
# Running 'USE_DOCKER=true make' uses docker mkdocs
.PHONY: prepare_docs generate_docs deploy test_docs
MKDOCS_DOCKER_IMAGE := squidfunk/mkdocs-material
DOCS_DIST_DIR := ./docs
DOCS_SRC_DIR := ./documentation
USE_DOCKER ?=
.DEFAULT_GOAL := generate_docs
prepare_docs:
@echo "Preparing documentation."
poetry install --with docs,unstable
poetry run python $(DOCS_SRC_DIR)/generate_documentation.py
mkdir -p $(DOCS_DIST_DIR)/logos
mkdir -p $(DOCS_DIST_DIR)/img
mkdir -p $(DOCS_DIST_DIR)/expansion/logos
mkdir -p $(DOCS_DIST_DIR)/export_mod/logos
mkdir -p $(DOCS_DIST_DIR)/import_mod/logos
cp -R $(DOCS_SRC_DIR)/logos/* $(DOCS_DIST_DIR)/logos
cp -R $(DOCS_SRC_DIR)/img/* $(DOCS_DIST_DIR)/img
cp -R $(DOCS_SRC_DIR)/logos/* $(DOCS_DIST_DIR)/expansion/logos
cp -R $(DOCS_SRC_DIR)/logos/* $(DOCS_DIST_DIR)/export_mod/logos
cp -R $(DOCS_SRC_DIR)/logos/* $(DOCS_DIST_DIR)/import_mod/logos
cp $(DOCS_SRC_DIR)/mkdocs/*.md $(DOCS_DIST_DIR)
cp LICENSE $(DOCS_DIST_DIR)/license.md
generate_docs: prepare_docs
ifeq ($(USE_DOCKER), true)
@echo "Generating documentation using '$(MKDOCS_DOCKER_IMAGE)'."
docker run --rm -it -v $(PWD):/docs $(MKDOCS_DOCKER_IMAGE) build
else
@echo "Generating docunentation."
poetry run mkdocs build
endif
deploy: generate_docs
ifeq ($(USE_DOCKER), true)
@echo "Deploying documentation using '$(MKDOCS_DOCKER_IMAGE)'."
docker run --rm -it -v $(PWD):/docs -v /home/$(whoami)/.docker:/root/.docker:ro $(MKDOCS_DOCKER_IMAGE) gh-deploy
else
@echo "Deploying docunentation."
poetry run mkdocs gh-deploy
endif
test_docs: prepare_docs
ifeq ($(USE_DOCKER), true)
@echo "Serving documentation using '$(MKDOCS_DOCKER_IMAGE)'."
docker run --rm -it -v $(PWD):/docs -p 8000:8000 $(MKDOCS_DOCKER_IMAGE)
else
@echo "Serving docunentation."
poetry run mkdocs serve
endif