本文介绍了使用 Appveyor CI 自动从 \(\LaTeX\) 生成 PDF 并发布到 Github Release 的两个方法。
创建密钥
首先在https://github.com/settings/tokens上创建密钥。根据 github 仓库的权限的不同,最小权限可设为 repo 或 public_repo。
编写 appveyor.yml
本来使用 windows 的镜像加上 choco install miktex 来生成是最简单的,而且对中文的支持很好。
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
| version: '1.0.{build}'
skip_tags: true
install:
- ps: choco install -y miktex
- cmd: refreshenv
build_script:
- cmd: pdflatex --synctex=1 -interaction=nonstopmode -file-line-error -recorder FILENAME.tex
- cmd: pdflatex --synctex=1 -interaction=nonstopmode -file-line-error -recorder FILENAME.tex
- cmd: pdflatex --synctex=1 -interaction=nonstopmode -file-line-error -recorder FILENAME.tex
artifacts:
- path: FILENAME.pdf
name: FILENAME
deploy:
description: ''
provider: GitHub
auth_token:
secure: YOUR_AUTH_TOKEN
artifact: essays.pdf
force_update: true
draft: false
prerelease: false
appveyor_repo_tag: false
|
但是非常遗憾的是https://chocolatey.org上的 MiKTex 安装包的版本老是滞后,经常导致安装失败。经过多次试验,采用 Ubuntu 镜像来安装 Texlive,再使用 xelatex 来支持中文。
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
| version: '1.0.{build}'
skip_tags: true
image:
- Ubuntu
install:
- sh: sudo apt-get update -y
- sh: sudo apt-get install texlive-lang-all texlive-latex-extra texlive-xetex -y
build_script:
- sh: xelatex FILENAME.tex
- sh: xelatex FILENAME.tex
- sh: xelatex FILENAME.tex
artifacts:
- path: FILENAME.pdf
name: FILENAME
deploy:
description: ''
provider: GitHub
auth_token:
secure: YOUR_AUTH_TOKEN
artifact: essays.pdf
force_update: true
draft: false
prerelease: false
appveyor_repo_tag: false
|
Author
winsphinx
LastMod
2019-11-29
(4e304ae1)
[原创] PDF w/ Appveyor
License
