-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
62 lines (46 loc) · 1.75 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
SHELL := bash # we want bash behaviour in all shell invocations
# Define the node_modules/.bin and append to PATH
NODE_MODULES_BIN := node_modules/.bin
export PATH := $(NODE_MODULES_BIN):$(PATH)
# https://stackoverflow.com/questions/4842424/list-of-ansi-color-escape-sequences
BOLD := \033[1m
NORMAL := \033[0m
GREEN := \033[1;32m
HELP_TARGET_DEPTH ?= \#
.PHONY: help
help: # Help
@printf "\nThis is a list of all the make targets that you can run, e.g. $(BOLD)make server$(NORMAL)\n\n"
@awk -F':+ |$(HELP_TARGET_DEPTH)' '/^[0-9a-zA-Z._%-]+:+.+$(HELP_TARGET_DEPTH).+$$/ { printf "$(GREEN)%-20s\033[0m %s\n", $$1, $$3 }' $(MAKEFILE_LIST) | sort
@echo
deps: # Install dependencies
npm install
npm install hexo-cli
clean: # Remove generated files and cache
@hexo clean
generate: # Generate static files
@hexo generate
server: # Start the deamon server with default port 4000
@hexo server
test-server: generate # Start the server with new port 4001
@hexo server --port 4001 > /dev/null 2>&1 &
test: # Test hexo server with port 4001
@curl -Is http://localhost:4001/ | head -n 1
image: # Create blog docker image
@docker build -t xianpengshen/blog .
release-image: image # Publish docker image to Docker Hub.
@docker push xianpengshen/blog:latest
package: # Copy files for packaing
@echo "== copy new README.md"
@cp source/README.md public/
@ls public/README.md
@echo "== copy new LICENSE"
@cp source/LICENSE public/
@ls public/LICENSE
@echo "== copy new workflow yml"
@mkdir -p public/.github/workflows/
@cp -r source/.github/workflows/*.yml public/.github/workflows/
@ls public/.github/workflows/*.yml
deploy: # Deploy your website
@hexo deploy
release: clean generate new-server test package deploy # Release blog manully
@echo "== Release ✅ Succeeded."