Skip to content

build pdf

build pdf #6

Workflow file for this run

name: build pdf
on:
workflow_dispatch:
push:
branches:
- main
paths:
- "**.tex"
- "**.bib"
jobs:
build:
runs-on: ubuntu-latest
env:
# one filename per line, including directory if in a subdirectory
FILES: |
note.tex
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install and run Git hooks
run: |
git config core.hooksPath .githooks/
git checkout
- name: Compile LaTeX document
uses: xu-cheng/latex-action@v2
with:
root_file: ${{ env.FILES }}
latexmk_shell_escape: true
work_in_root_file_dir: true
- name: Move output pdf's preserving directory structure
run: |
mkdir github-artifacts
echo -n "${{ env.FILES }}" | awk '{$1=$1};1' | sed "s/.tex$/.pdf/g" | rsync -a --files-from=- . ./github-artifacts
- name: Upload pdf's as artifact
uses: actions/upload-artifact@v3
with:
name: pdfs
path: ./github-artifacts
deploy:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
path: github-artifacts
- name: Move pdf
run: mkdir -p github-deploy && mv github-artifacts/*/* github-deploy
- name: Deploy on orphan branch
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./github-deploy
publish_branch: build
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
# remove this option if you want to have all builds preserved in the build directory
force_orphan: true
- name: Delete artifacts
uses: geekyeggo/delete-artifact@v2
with:
name: pdfs