-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMakefile
64 lines (54 loc) · 2.59 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
64
IN_DOCKER_GROUP=$(filter docker,$(shell groups))
DOCKER=$(if $(or $(IN_DOCKER_GROUP),$(IS_ROOT),$(OSX)),docker,sudo docker)
CURRENT_UID=$(shell id -u)
CURRENT_GID=$(shell id -g)
RUBY_VERSION=3.3
all: build_jekyll build_mkdocs cleanup_docs
build_jekyll:
$(DOCKER) run -v $(PWD):/srv/jekyll jekyll/builder \
sh -c \
"jekyll build"
checkout_kube_router_docs:
$(eval kube_checkout := $(shell mktemp -d))
git clone https://github.com/cloudnativelabs/kube-router.git $(kube_checkout)
cp -r $(kube_checkout)/docs kube-router
@mkdir -p kube-router/docs/manifests
cp $(kube_checkout)/daemonset/* kube-router/docs/manifests
cp $(kube_checkout)/CONTRIBUTING.md kube-router/docs
cp $(kube_checkout)/RELEASE.md kube-router/docs
# Manual fixups of broken links
# Fix links to daemonset files
sed -i 's;\.\./daemonset;manifests;' kube-router/docs/dsr.md
sed -i 's;\.\./daemonset;manifests;' kube-router/docs/user-guide.md
sed -i 's;\.\./daemonset;manifests;' kube-router/docs/RELEASE.md
# Fix links to CONTRIBUTING.md
sed -i 's;/CONTRIBUTING.md;/docs/CONTRIBUTING/;' kube-router/docs/index.md
sed -i 's;/CONTRIBUTING.md;/docs/CONTRIBUTING/;' kube-router/docs/developing.md
# Fix links to RELEASE.md
sed -i 's;/RELEASE.md;/docs/RELEASE/;' kube-router/docs/developing.md
# Fix links to Makefile
sed -i 's;\[Makefile\](/Makefile);Makefile;' kube-router/docs/developing.md
sed -i 's;\[Makefile\](Makefile);Makefile;' kube-router/docs/RELEASE.md
# Fix links inside CONTRIBUTING.md
sed -i 's;/developing.md;/developing/;' kube-router/docs/CONTRIBUTING.md
sed -i 's;/user-guide.md;/user-guide/;' kube-router/docs/CONTRIBUTING.md
# Remove links to workflows, go mods, and Daemonset folder from RELEASE.md
sed -i 's;\[Github Workflow\](\.github/workflow/ci.yml);Github Workflow;' kube-router/docs/RELEASE.md
sed -i 's;\[go.mod\](go.mod);go.mod;' kube-router/docs/RELEASE.md
sed -i 's;\[Daemonset\](daemonset);daemonset;' kube-router/docs/RELEASE.md
rm -rf $(kube_checkout)
build_mkdocs: checkout_kube_router_docs
$(DOCKER) run -v $(PWD):/docs squidfunk/mkdocs-material \
build --site-dir /docs/kube-router -d /docs/docs --strict
sudo chown -R $(CURRENT_UID):$(CURRENT_GID) .
cleanup_docs:
rm -rf kube-router/docs
serve: build_mkdocs cleanup_docs
$(DOCKER) run -ti -v $(PWD):/srv/jekyll --rm --publish [::1]:4000:4000 jekyll/builder jekyll serve
update-gems:
$(DOCKER) run -ti -v $(PWD):/build --rm -w /build ruby:$(RUBY_VERSION) bundle update
#all:
# jekyll build
# mkdocs build --site-dir kube-router/docs -d _site/docs
.PHONY: build_jekyll build_mkdocs checkout_kube_router_docs cleanup_docs serve update-gems
.DEFAULT: all