forked from crossplane/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
76 lines (65 loc) · 2.28 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
65
66
67
68
69
70
71
72
73
74
75
# Run jekyll in development mode
LOCAL_DOCS_DIR := docs/local
run: _data/versions.json
docker run --rm -it \
-p 4000:4000 -p 4001:4001 \
-v="$(PWD)/vendor/bundle:/usr/local/bundle" \
-v "$(PWD):/srv/jekyll" \
jekyll/jekyll -- \
jekyll serve --livereload --livereload-port 4001
run_docs_local: local_docs_dir _data/versions.json
docker run --rm -it \
-p 4000:4000 -p 4001:4001 \
-v="$(PWD)/vendor/bundle:/usr/local/bundle" \
-v "$(PWD):/srv/jekyll" \
-v "$(GOPATH)/src/github.com/crossplane/crossplane/docs:/srv/jekyll/$(LOCAL_DOCS_DIR)" \
jekyll/jekyll -- \
jekyll serve --livereload --livereload-port 4001
rm -d $(LOCAL_DOCS_DIR)
run_docs_local_incremental: local_docs_dir _data/versions.json
docker run --rm -it \
-p 4000:4000 -p 4001:4001 \
-v="$(PWD)/vendor/bundle:/usr/local/bundle" \
-v "$(PWD):/srv/jekyll" \
-v "$(GOPATH)/src/github.com/crossplane/crossplane/docs:/srv/jekyll/$(LOCAL_DOCS_DIR)" \
jekyll/jekyll -- \
jekyll serve --incremental --livereload --livereload-port 4001
rm -d $(LOCAL_DOCS_DIR)
# Build (output is in _site)
build: _data/versions.json
docker run --rm -it \
-v="$(PWD)/vendor/bundle:/usr/local/bundle" \
-v "$(PWD):/srv/jekyll" \
jekyll/jekyll -- \
jekyll build
# Build (output is in _site)
bundle_update: _data/versions.json
docker run --rm -it \
-v="$(PWD)/vendor/bundle:/usr/local/bundle" \
-v "$(PWD):/srv/jekyll" \
jekyll/jekyll -- \
bundle update
# Push new changes to the live site
publish: _data/versions.json
$(eval ROOT_DIR = $(shell pwd -P))
git -C "$(ROOT_DIR)" add -A
@if git -C "$(ROOT_DIR)" diff-index --cached --quiet HEAD --; then\
echo "no changes detected";\
else \
echo "committing changes...";\
git -C "$(ROOT_DIR)" -c user.email="info@crossplane.io" -c user.name="Crossplane" commit --message="docs snapshot for crossplane version \`$(DOCS_VERSION)\`"; \
echo "pushing changes..."; \
git -C "$(ROOT_DIR)" push; \
echo "crossplane.github.io changes published"; \
fi
# Generate versions.json
_data/versions.json: node_modules docs
node preprocess.js
@touch _data/versions.json
# Install node_modules
node_modules: package.json package-lock.json
npm install
@touch node_modules
# Create the local docs dir needed before _data/versions.json in some cases
local_docs_dir:
mkdir -p $(LOCAL_DOCS_DIR)