Skip to content

Export wiki to pdf

Export wiki to pdf #73

Workflow file for this run

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