将文档部署到 GitHub Pages

问题描述 投票:0回答:1

我正在尝试使用 GitHub Actions 将从

.tex
文件构建的 PDF 部署到 GitHub Pages。 YAML 文件可在此处获取:

name: Build and Deploy LaTeX document
on:
  push:
    branches:
      - main
jobs:
  build:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - uses: actions/[email protected]
      - uses: xu-cheng/[email protected]
        with:
          root_file: main.tex
      - uses: actions/[email protected]
        with:
          name: main-pdf
          path: main.pdf
  deploy:
    runs-on: ubuntu-latest
    needs: build
    permissions:
      pages: write
      id-token: write
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    steps:
      - uses: actions/[email protected]
        with:
          name: main-pdf
          path: .
      - uses: actions/[email protected]
      - uses: actions/[email protected]
        with:
          path: .
      - uses: actions/[email protected]
        with:
          token: ${{ secrets.GH_PAT }}
          artifact_name: main.pdf

我遇到了一些与部署阶段相关的问题,因为找不到 PDF 文件:

enter image description here

github github-actions github-pages
1个回答
0
投票
name: Build and Deploy LaTeX document
permissions: write-all

on:
  push:
    branches: [ "main" ]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/[email protected]
      - uses: xu-cheng/[email protected]
        with:
          root_file: main.tex
      - uses: docker://ghcr.io/michal-h21/make4ht-action:latest
        env:
          command: "make4ht -d out main.tex"
      - run: |
          cd out
          sudo mv main.html index.html
      - uses: actions/[email protected]
        with:
          name: main-pdf
          path: main.pdf
      - uses: softprops/[email protected]
        with:
          tag_name: Current
          files: main.pdf
      - uses: peaceiris/[email protected]
        with:
          github_token: ${{ secrets.GH_PAT }}
          publish_dir: ./out
© www.soinside.com 2019 - 2024. All rights reserved.