Adi*_*agh 2 pdf latex github-actions
每当进行提交时,我都会尝试从resume.tex我的简历存储库文件中构建一份简历 pdf 。
我收到以下错误。
Error: File '/home/runner/work/resume/resume/resume.tex' cannot be found from the directory '/github/workspace'.
Run Code Online (Sandbox Code Playgroud)
我应该如何访问该resume.tex文件?如果我只是说root_file: resume.tex,错误是:
Error: File 'resume.tex' cannot be found from the directory '/github/workspace'.
Run Code Online (Sandbox Code Playgroud)
该.github/workflows/build_resume.yml文件看起来像这样。该resume.tex文件位于我的存储库的根目录中。
# This is a basic workflow to help you get started with Actions
name: Build PDF on commit.
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
# 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:
- name: Github Action for LaTeX
uses: xu-cheng/latex-action@v2
with:
# The root LaTeX file to be compiled
root_file: ${{ github.workspace }}/resume.tex
# Interpret the root_file input as bash glob pattern
# glob_root_file: # optional
# The working directory for this action
# working_directory: # optional
# The LaTeX engine to be invoked
# compiler: # optional, default is latexmk
# Extra arguments to be passed to the LaTeX engine
# args: # optional, default is -pdf -file-line-error -halt-on-error -interaction=nonstopmode
# [Deprecated] Install extra packages by tlmgr
# extra_packages: # optional
# Install extra packages by apk
# extra_system_packages: # optional
# Install extra .ttf/.otf fonts.
# extra_fonts: ./fonts/*.ttf
# Arbitrary bash codes to be executed before compiling LaTeX documents
pre_compile: tlmgr update --self && tlmgr update --all
# Arbitrary bash codes to be executed after compiling LaTeX documents
post_compile: latexmk -c
# Instruct latexmk to enable --shell-escape
# latexmk_shell_escape: # optional
# Instruct latexmk to use LuaLaTeX
# latexmk_use_lualatex: # optional
# Instruct latexmk to use XeLaTeX
latexmk_use_xelatex: true
Run Code Online (Sandbox Code Playgroud)
当您想要从当前存储库执行文件时,您需要首先使用actions/checkout(在作业步骤的开头)。
这将允许您访问工作流程中的存储库( Github 环境变量$github_workspace之一)。
注意:使用后运行的所有命令都action/checkout将在存储库根目录中执行。
例如,考虑到您的resume.tex文件位于存储库的根目录,您将使用如下内容:
name: Example
on:
push:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v2.3.4
- name: show resume.tex file content
run: cat resume.tex
Run Code Online (Sandbox Code Playgroud)
这是来自个人存储库的另一个工作流示例,如果您想在工作流中执行位于存储库中的特定脚本,则遵循相同的逻辑。执行任何操作。
| 归档时间: |
|
| 查看次数: |
13648 次 |
| 最近记录: |