如何解决在 GitHub 工作流程中使用 Base64 图像编译 Latex 文件
我正在尝试使用 GitHub 工作流程编译 Latex 文档。通常这不是问题。 但是我需要隐藏一个图像,因为它不能在 git 中公开。所以我安全地将 Base64 文件存储在外部 WebServer 上。我通过 WGet 命令获取 Base64 文本块并将其作为图像转换回我。我这样做如下。
- name: Build Sign image
run: |
wget ${{ secrets.BASE }} -o ./sign.b64
sudo chmod +x ./sign.b64
base64 -w 0 ./sign.b64 | base64 -d > ./img.png
mv ./img.png ./image.png
之后我在工作流程中编译乳胶文件。我这样做如下:
- name: Compile LaTeX document
uses: xu-cheng/latex-action@v2
with:
args: -f
root_file: ./Hausarbeit.tex
我像往常一样包含图像。但是,我不为此使用浮动环境,因为否则图像无处不在。不幸的是不是它应该在的地方。但是,它也不适用于浮动环境。因此我这样做:
Run xu-cheng/latex-action@v2
/usr/bin/docker run --name a33c1f1c7b887132c44ef9c6b6c0aca1a13a3_e646d6 --label 8a33c1 --workdir /github/workspace --rm -e INPUT_ARGS -e INPUT_ROOT_FILE -e INPUT_WORKING_DIRECTORY -e INPUT_COMPILER -e INPUT_EXTRA_PACKAGES -e INPUT_EXTRA_SYstem_PACKAGES -e INPUT_PRE_COMPILE -e INPUT_POST_COMPILE -e INPUT_latexmk_SHELL_ESCAPE -e INPUT_latexmk_USE_LUALATEX -e INPUT_latexmk_USE_XELATEX -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/TestPy/TestPy":"/github/workspace" 8a33c1:f1c7b887132c44ef9c6b6c0aca1a13a3 "./Hausarbeit.tex" "" "latexmk" "-f" "" "" "" "" "" "" ""
Compile ./Hausarbeit.tex
Rc files read:
NONE
latexmk: This is latexmk,John Collins,29 May 2021,version: 4.74b.
Rule 'latex': File changes,etc:
latexmk: applying rule 'latex'...
Changed files,or newly in use since prevIoUs run(s):
'./Hausarbeit.tex'
------------
Run number 1 of rule 'latex'
------------
------------
Running 'latex -recorder "./Hausarbeit.tex"'
------------
This is pdfTeX,Version 3.141592653-2.6-1.40.22 (TeX Live 2021) (preloaded format=latex)
restricted \write18 enabled.
entering extended mode
(./Hausarbeit.tex
LaTeX2e <2021-06-01> patch level 1
L3 programming layer <2021-06-18>
(/opt/texlive/texdir/texmf-dist/tex/latex/base/article.cls
Document Class: article 2021/02/12 v1.4n Standard LaTeX document class
(/opt/texlive/texdir/texmf-dist/tex/latex/base/size10.clo))
(/opt/texlive/texdir/texmf-dist/tex/latex/graphics/graphicx.sty
(/opt/texlive/texdir/texmf-dist/tex/latex/graphics/keyval.sty)
(/opt/texlive/texdir/texmf-dist/tex/latex/graphics/graphics.sty
(/opt/texlive/texdir/texmf-dist/tex/latex/graphics/trig.sty)
(/opt/texlive/texdir/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(/opt/texlive/texdir/texmf-dist/tex/latex/graphics-def/dvips.def)))
(/opt/texlive/texdir/texmf-dist/tex/latex/l3backend/l3backend-dvips.def)
(./Hausarbeit.aux)
! LaTeX Error: Cannot determine size of graphic in image.png (no BoundingBox).
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.21 ...egraphics[width=0.50\textwidth]{image.png}
?
! Emergency stop.
...
l.21 ...egraphics[width=0.50\textwidth]{image.png}
No pages of output.
Transcript written on Hausarbeit.log.
latexmk: Log file says no output from latex
latexmk: For rule 'latex',no output was made
Rule 'latex': File changes,etc:
Changed files,or newly in use since prevIoUs run(s):
'Hausarbeit.aux'
------------
Run number 2 of rule 'latex'
------------
------------
Running 'latex -recorder "./Hausarbeit.tex"'
------------
latexmk: Examining 'Hausarbeit.log'
=== TeX engine is 'pdfTeX'
latexmk: applying rule 'latex'...
This is pdfTeX,no output was made
Failure to make 'Hausarbeit.dvi'
Collected error summary (may duplicate other messages):
latexmk: Examining 'Hausarbeit.log'
=== TeX engine is 'pdfTeX'
latex: Command for 'latex' gave return code 1
latexmk: Errors,in force_mode: so I tried finishing targets
Refer to 'Hausarbeit.log' for details
完整的工作流程如下所示:
name: Pylint
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: "0 0 * * 4"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Git v2
uses: actions/checkout@v2
- name: Update Ubuntu
run: |
sudo apt-get update -y
sudo apt-get install -y cl-base64
sudo apt-get install wget
- name: Build Sign image
run: |
wget ${{ secrets.BASE }} -o ./sign.b64
sudo chmod +x ./sign.b64
base64 -w 0 ./sign.b64 | base64 -d > ./img.png
mv ./img.png ./image.png
# cat sign.b64 | base64 --decode > img.png
- name: Compile LaTeX document
uses: xu-cheng/latex-action@v2
with:
args: -f
root_file: ./Hausarbeit.tex
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: setup python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Build Artifact
uses: actions/upload-artifact@v2
with:
name: Latex
path: ./*.pdf
- name: execute py script
run: |
python upload.py ./Hausarbeit.pdf
env:
key: ${{ secrets.FTPPWD }}
user: ${{ secrets.FTPUSER }}
- name: Clean GitHub
run: |
git clean -fX
很遗憾我不知道该怎么做,希望您能帮助我。
致以亲切的问候 泽伊克斯
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。