加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Makefile 1.92 KB
一键复制 编辑 原始数据 按行查看 历史
SERVER ?= api.annhe.net
USER ?= root
PORT ?= 22
DIR ?= /PanBook
HIGHLIGHT ?= --highlight-style=tango
DEBUG ?=
OWNER ?= annProg
REPO ?= PanBook
TAG ?= $(shell git rev-parse --short HEAD)
DIVISION = --top-level-division=chapter
CJK ?= -V CJKmainfont:思源宋体 -V CJKoptions:BoldFont=Source\ Han\ Serif\ SC\ Heavy,ItalicFont=FandolKai,SmallCapsFont=思源黑体 -V mainfont:Source\ Serif\ Pro -V sansfont:Source\ Sans\ Pro -V monofont:Source\ Code\ Pro
all: ctex ctex6in elegantbook epub online
book: ctex ctex6in elegantbook
ctex:
panbook book -V cover:R $(DIVISION) $(CJK) $(DEBUG) $(HIGHLIGHT)
ctex6in:
panbook book -V cover:R -V device:mobile $(DIVISION) $(CJK) $(DEBUG) $(HIGHLIGHT)
elegantbook:
panbook book --style=elegantbook $(DIVISION) $(CJK) $(DEBUG) $(HIGHLIGHT)
epub:
rm -f build/*.epub
panbook book --style=epub $(DEBUG) $(HIGHLIGHT)
mv build/$(REPO)-*.epub build/$(REPO).epub
up: release upload
release:
git tag -a $(TAG) -m "$(TAG)"
git push origin $(TAG)
curl -H "Content-Type:application/json" -H "Authorization: token $$GITHUB_TOKEN" -XPOST "https://api.github.com/repos/$(OWNER)/$(REPO)/releases" -d '{"tag_name":"$(TAG)"}'
upload:
ID=`curl -s -H "Authorization: token $$GITHUB_TOKEN" "https://api.github.com/repos/$(OWNER)/$(REPO)/releases/tags/$(TAG)" |grep '"id"' |head -n 1 |awk '{print $$2}' |tr -d ','`; echo "ID: $$ID";\
cd build/; \
for FILE in `ls $(REPO)-*.pdf` $(REPO).epub;do \
echo $$FILE;\
curl -H "Authorization: token $$GITHUB_TOKEN" -H "Content-Type: $$(file -b --mime-type $$FILE)" "https://uploads.github.com/repos/$(OWNER)/$(REPO)/releases/$$ID/assets?name=$$(basename $$FILE)" --data-binary @$$FILE; echo; \
done
online:
scp -P $(PORT) build/$(REPO)-book-*.pdf $(USER)@$(SERVER):$(DIR)
scp -P $(PORT) build/$(REPO).epub $(USER)@$(SERVER):$(DIR)
aliyun:
cat Dockerfile |sed '/^FROM alpine/a\RUN sed -i "s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g" /etc/apk/repositories' > Dockerfile.aliyun
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化