-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
34 lines (25 loc) · 807 Bytes
/
Makefile
File metadata and controls
34 lines (25 loc) · 807 Bytes
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
.PHONY: restart clean build serve stop deploy
PORT := 4000
OSS_BUCKET := oss://tq-techweb
-include .env
export
OSS_FLAGS := -i $(AccessKeyID) -k $(AccessKeySecret) --region $(OSS_REGION)
stop:
@kill $$(lsof -ti:$(PORT)) 2>/dev/null || true
@sleep 1
clean:
npx hexo clean
build: clean
npx hexo generate
serve:
npx http-server public -p $(PORT) -c-1
restart: stop build serve
deploy: build
@echo ">>> Syncing public/ to $(OSS_BUCKET) ..."
ossutil sync public/ $(OSS_BUCKET)/ --delete --force $(OSS_FLAGS)
@echo ">>> Cleaning up OSS directory markers ..."
@ossutil ls $(OSS_BUCKET)/ $(OSS_FLAGS) 2>/dev/null \
| grep '\s0\s\+Standard' \
| grep -oP 'oss://\S+/$$' \
| while IFS= read -r obj; do ossutil rm "$$obj" $(OSS_FLAGS) >/dev/null 2>&1; done || true
@echo ">>> Deploy complete."