This repository was archived by the owner on Jul 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
192 lines (167 loc) · 8.87 KB
/
main.yml
File metadata and controls
192 lines (167 loc) · 8.87 KB
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# This is a basic workflow to help you get started with Actions
name: Build PDF
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "master" branch
push:
branches: [ "master" ]
tags:
- 'v*'
pull_request:
branches: [ "master" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
# Runs a single command using the runners shell
- name: Create Temp Files
run: |
echo JXNU Asscoiation of Computer Science
pwd
mkdir $HOME/build/
mkdir $HOME/build/1/
mkdir $HOME/build/2/
mkdir $HOME/build/3/
mkdir $HOME/build/4/
mkdir $HOME/build/5/
cp 1-数学.md $HOME/build/1/
cp 2-数据结构.md $HOME/build/2/
cp 3-字符串.md $HOME/build/3/
cp 4-计算几何.md $HOME/build/4/
cp 5-图论.md $HOME/build/5/
mkdir -p $HOME/build/1/pandoc/
mkdir -p $HOME/build/2/pandoc/
mkdir -p $HOME/build/3/pandoc/
mkdir -p $HOME/build/4/pandoc/
mkdir -p $HOME/build/5/pandoc/
cp ./pandoc/gen.sh -p $HOME/build/1/pandoc/
cp ./pandoc/gen.sh -p $HOME/build/2/pandoc/
cp ./pandoc/gen.sh -p $HOME/build/3/pandoc/
cp ./pandoc/gen.sh -p $HOME/build/4/pandoc/
cp ./pandoc/gen.sh -p $HOME/build/5/pandoc/
cp ./pandoc/minted.py -p $HOME/build/1/pandoc/
cp ./pandoc/minted.py -p $HOME/build/2/pandoc/
cp ./pandoc/minted.py -p $HOME/build/3/pandoc/
cp ./pandoc/minted.py -p $HOME/build/4/pandoc/
cp ./pandoc/minted.py -p $HOME/build/5/pandoc/
- name: Install dependencies
run: |
wget https://github.com/jgm/pandoc/releases/download/2.10.1/pandoc-2.10.1-1-amd64.deb
sudo dpkg -i pandoc-2.10.1-1-amd64.deb
pandoc --version
pip install pandocfilters
- name: Copy Algo.latex to Template Dir
run: |
mkdir -p /home/runner/.pandoc/date/templates/
mkdir -p /home/runner/.pandoc/templates/
cp ./pandoc/algo.latex /home/runner/.pandoc/date/templates/
cp ./pandoc/algo.latex /home/runner/.pandoc/templates/
- name: Build Full version
run: |
mkdir -p $HOME/work/ACM_Algorithm_Library/ACM_Algorithm_Library/TexDocument/
cd $HOME/build/1/
mkdir complie
pandoc --template algo --filter ./pandoc/minted.py --pdf-engine=xelatex --no-highlight --pdf-engine-opt="-shell-escape" -o template.tex --from markdown -V mainfont="Source Han Serif CN" -V monofont="Source Code Pro" -V sansfont="Source Han Sans CN" -V CJKmainfont="Source Han Serif CN" -V secnumdepth=2 -V --number-sections --toc -V include-before="\renewcommand\labelitemi{$\bullet$}" -V header-includes="\usepackage{minted}" -V geometry="margin=2cm" *-*.md
pwd
cd $HOME/build/2/
mkdir complie
pandoc --template algo --filter ./pandoc/minted.py --pdf-engine=xelatex --no-highlight --pdf-engine-opt="-shell-escape" -o template.tex --from markdown -V mainfont="Source Han Serif CN" -V monofont="Source Code Pro" -V sansfont="Source Han Sans CN" -V CJKmainfont="Source Han Serif CN" -V secnumdepth=2 -V --number-sections --toc -V include-before="\renewcommand\labelitemi{$\bullet$}" -V header-includes="\usepackage{minted}" -V geometry="margin=2cm" *-*.md
pwd
cd $HOME/build/3/
mkdir complie
pandoc --template algo --filter ./pandoc/minted.py --pdf-engine=xelatex --no-highlight --pdf-engine-opt="-shell-escape" -o template.tex --from markdown -V mainfont="Source Han Serif CN" -V monofont="Source Code Pro" -V sansfont="Source Han Sans CN" -V CJKmainfont="Source Han Serif CN" -V secnumdepth=2 -V --number-sections --toc -V include-before="\renewcommand\labelitemi{$\bullet$}" -V header-includes="\usepackage{minted}" -V geometry="margin=2cm" *-*.md
pwd
cd $HOME/build/4/
mkdir complie
pandoc --template algo --filter ./pandoc/minted.py --pdf-engine=xelatex --no-highlight --pdf-engine-opt="-shell-escape" -o template.tex --from markdown -V mainfont="Source Han Serif CN" -V monofont="Source Code Pro" -V sansfont="Source Han Sans CN" -V CJKmainfont="Source Han Serif CN" -V secnumdepth=2 -V --number-sections --toc -V include-before="\renewcommand\labelitemi{$\bullet$}" -V header-includes="\usepackage{minted}" -V geometry="margin=2cm" *-*.md
pwd
cd $HOME/build/5/
mkdir complie
pandoc --template algo --filter ./pandoc/minted.py --pdf-engine=xelatex --no-highlight --pdf-engine-opt="-shell-escape" -o template.tex --from markdown -V mainfont="Source Han Serif CN" -V monofont="Source Code Pro" -V sansfont="Source Han Sans CN" -V CJKmainfont="Source Han Serif CN" -V secnumdepth=2 -V --number-sections --toc -V include-before="\renewcommand\labelitemi{$\bullet$}" -V header-includes="\usepackage{minted}" -V geometry="margin=2cm" *-*.md
pwd
cp $HOME/build/1/template.tex $HOME/work/ACM_Algorithm_Library/ACM_Algorithm_Library/TexDocument/part1.tex
cp $HOME/build/2/template.tex $HOME/work/ACM_Algorithm_Library/ACM_Algorithm_Library/TexDocument/part2.tex
cp $HOME/build/3/template.tex $HOME/work/ACM_Algorithm_Library/ACM_Algorithm_Library/TexDocument/part3.tex
cp $HOME/build/4/template.tex $HOME/work/ACM_Algorithm_Library/ACM_Algorithm_Library/TexDocument/part4.tex
cp $HOME/build/5/template.tex $HOME/work/ACM_Algorithm_Library/ACM_Algorithm_Library/TexDocument/part5.tex
cd $HOME/
ls
- name: Create PDF Build DIR
run: mkdir -p $HOME/work/ACM_Algorithm_Library/ACM_Algorithm_Library/PDFDocument/
- name: Compile LaTeX document
uses: xu-cheng/latex-action@v2
with:
root_file: |
./TexDocument/part1.tex
./TexDocument/part2.tex
./TexDocument/part3.tex
./TexDocument/part4.tex
./TexDocument/part5.tex
latexmk_use_xelatex: true
latexmk_shell_escape: true
extra_fonts: ./pandoc/font/*.otf
- name: Move built pdf to PDF dir
run: |
rm ./PDFDocument/*
mv part1.pdf ./PDFDocument/part1.pdf
mv part2.pdf ./PDFDocument/part2.pdf
mv part3.pdf ./PDFDocument/part3.pdf
mv part4.pdf ./PDFDocument/part4.pdf
mv part5.pdf ./PDFDocument/part5.pdf
cp ./TexDocument/Cover/ICPC.png ./
- name: Build Cover
uses: xu-cheng/latex-action@v2
with:
root_file: |
./TexDocument/Cover/cover1.tex
./TexDocument/Cover/cover2.tex
./TexDocument/Cover/cover3.tex
./TexDocument/Cover/cover4.tex
./TexDocument/Cover/cover5.tex
latexmk_use_xelatex: true
latexmk_shell_escape: true
extra_fonts: ./pandoc/font/*.otf
- name: Move built cover to PDF dir
run: |
mv cover1.pdf ./PDFDocument/
mv cover2.pdf ./PDFDocument/
mv cover3.pdf ./PDFDocument/
mv cover4.pdf ./PDFDocument/
mv cover5.pdf ./PDFDocument/
- name: Merge PDF
run: |
sudo apt-get install poppler-utils
cd ./PDFDocument/
sudo pdfunite cover1.pdf part1.pdf part1-Math.pdf
sudo pdfunite cover2.pdf part2.pdf part2-DataStructure.pdf
sudo pdfunite cover3.pdf part3.pdf part3-String.pdf
sudo pdfunite cover4.pdf part4.pdf part4-Geometry.pdf
sudo pdfunite cover5.pdf part5.pdf part5-GraphTheory.pdf
rm cover1.pdf part1.pdf
rm cover2.pdf part2.pdf
rm cover3.pdf part3.pdf
rm cover4.pdf part4.pdf
rm cover5.pdf part5.pdf
cd $HOME
- name: Commit Changes
run: |
git config --global user.email "yanweiqi1754989931@live.com"
git config --global user.name "HeartFireY"
git add $HOME/work/ACM_Algorithm_Library/ACM_Algorithm_Library/TexDocument/*.tex
git add $HOME/work/ACM_Algorithm_Library/ACM_Algorithm_Library/PDFDocument/*.pdf
git commit -m "Generated Automatically by Workflow." -a
git config --global --add safe.directory '*'
- name: Push Changes
uses: ad-m/github-push-action@master
with:
branch: master
force: false
github_token: ${{ secrets.GITHUB_TOKEN }}