forked from rook/rook.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (44 loc) · 1.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
.PHONY: help run build publish
JEKYLL_DOCKER_IMAGE ?= jekyll/jekyll:3.7
.DEFAULT: help
help: ## Show this help menu.
@echo "Usage: make [TARGET ...]"
@echo ""
@grep --no-filename -E '^[a-zA-Z_%-. ]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
@echo ""
run: ## run jekyll in development mode
run: _data/projects.json
docker run --rm -it \
-p 4000:4000 -p 4001:4001 \
-v="$(PWD)/vendor/bundle:/usr/local/bundle" \
-v "$(PWD):/srv/jekyll" \
$(JEKYLL_DOCKER_IMAGE) -- \
jekyll serve --livereload --livereload-port 4001
build: ## build output is in _site
build: _data/projects.json
docker run --rm -it \
-v="$(PWD)/vendor/bundle:/usr/local/bundle" \
-v "$(PWD):/srv/jekyll" \
$(JEKYLL_DOCKER_IMAGE) -- \
jekyll build
publish: ## push new changes to the live site
publish: _data/projects.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="[email protected]" -c user.name="Rook" commit --message="docs snapshot for rook version \`$(DOCS_VERSION)\`"; \
echo "pushing changes..."; \
git -C "$(ROOT_DIR)" push; \
echo "rook.github.io changes published"; \
fi
_data/projects.json: ## generate projects.json
_data/projects.json: node_modules docs $(wildcard docs/*)
node preprocess.js
@touch _data/projects.json
node_modules: ## install node_modules
node_modules: package.json package-lock.json
npm ci
@touch node_modules