-
Notifications
You must be signed in to change notification settings - Fork 31
98 lines (87 loc) · 3.09 KB
/
export-pdf.yml
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Export wiki to pdf
on:
gollum
#on:
# push:
# branches:
# - export_pdf
jobs:
job1:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
steps:
- name: Checkout wiki
uses: actions/checkout@v4
with:
repository: DoctorReid/StarRailAutoProxy.wiki
ref: master
fetch-depth: 1
path: wiki
- name: Install pandoc
run: sudo apt-get install -y pandoc
- name: Install TeX Live
run: |
sudo apt-get install -y texlive-xetex
sudo apt-get install -y texlive-lang-chinese
- name: Install Noto Font
run: sudo apt-get install -y fonts-noto
- name: Execute fc-list command # https://github.com/jgm/pandoc/wiki/Pandoc-with-Chinese
run: |
output=$(fc-list :lang=zh)
echo "$output"
# - name: Get default template
# run: |
# cd wiki
# echo "\\usepackage{ctex}\n" > output/default.latex
# pandoc -D latex >> ./default.latex
# if ! git diff --quiet output/README.pdf; then
# git config user.name github-actions
# git config user.email [email protected]
# git add output/default.latex
# git commit -m "#126 默认的latex模板 $(date +%Y-%m-%d)"
# git push
# else
# echo "No modifications in default.latex"
# fi
- name: Convert Markdown to PDF
run: |
cd wiki
if [ ! -d "output" ]; then
mkdir output
fi
echo
cat "output/README_header.md" > output/README.md
echo -e "\n\n" >> output/README.md
cat "Home.md" >> output/README.md
echo -e "\n\n" >> output/README.md
cat "功能_校准.md" >> output/README.md
echo -e "\n\n" >> output/README.md
cat "功能_锄大地.md" >> output/README.md
echo -e "\n\n" >> output/README.md
cat "功能_日常.md" >> output/README.md
echo -e "\n\n" >> output/README.md
cat "功能_逐光捡金.md" >> output/README.md
echo -e "\n\n" >> output/README.md
cat "功能_模拟宇宙.md" >> output/README.md
echo -e "\n\n" >> output/README.md
cat "功能_一条龙.md" >> output/README.md
echo -e "\n\n" >> output/README.md
cat "设置.md" >> output/README.md
echo -e "\n\n" >> output/README.md
cat "常见Q&A.md" >> output/README.md
pandoc output/README.md -o output/README.pdf --pdf-engine=xelatex --columns=25 --wrap=auto --variable mainfont='Noto Serif CJK SC'
- name: Commit changes
run: |
cd wiki
ls -al "output"
if ! git diff --quiet output/README.pdf; then
git config user.name github-actions
git config user.email [email protected]
git add output/README.pdf
git commit -m "#126 自动转化wiki成pdf提交 $(date +%Y-%m-%d)"
git push
else
echo "No modifications in README.pdf"
fi