style: Optimize the style of the codes, preparing to release. #27
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # .github/workflows/release-pdf.yml | |
| # 工作流的名称 | |
| name: Release PDF on Tag | |
| # 触发工作流的事件 | |
| on: | |
| # 当有 push 操作时触发 | |
| push: | |
| # 仅在推送 "v" 开头的标签时触发, 例如 v1.0, v1.2.3 | |
| tags: | |
| - 'v*.*' | |
| # 工作流运行的任务 | |
| jobs: | |
| build_and_release: | |
| # 任务名称 | |
| name: Build LaTeX and Create Release | |
| # 运行此任务的虚拟机环境 | |
| runs-on: ubuntu-latest | |
| # ❗️ 在这里添加权限设置 ❗️ | |
| permissions: | |
| contents: write # 授予工作流写入仓库内容的权限,这是创建 Release 所必需的 | |
| # 任务执行的步骤 | |
| steps: | |
| # 步骤 1: 检出你的仓库代码 | |
| # 使得工作流可以访问你的 main.tex 等文件 | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # 步骤 2: 编译 LaTeX 文档 | |
| # 使用一个预先配置好的 Action 来安装 TeX Live 并执行编译 | |
| # https://github.com/xu-cheng/latex-action | |
| - name: Compile LaTeX document | |
| uses: xu-cheng/latex-action@v3 | |
| with: | |
| # 指定你的主 .tex 文件 | |
| root_file: main.tex | |
| # ❗️ 修改部分: | |
| # 我们不再直接指定 compiler,而是通过 args 告诉 latexmk 使用 xelatex。 | |
| # latexmk 会自动处理需要编译两次(或更多次)的情况。 | |
| args: -xelatex -interaction=nonstopmode | |
| # 步骤 3: 创建 Release 并上传 PDF | |
| # 当上述步骤成功编译出 main.pdf 后, 此步骤会执行 | |
| # https://github.com/softprops/action-gh-release | |
| - name: Create Release and Upload PDF | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| # 要上传的文件列表, 这里是编译生成的 PDF | |
| files: main.pdf | |
| # GITHUB_TOKEN 是由 GitHub 自动提供的, 无需手动设置 | |
| # 这个 token 允许 Action 在你的仓库中创建 Release |