87 lines
2.0 KiB
YAML
87 lines
2.0 KiB
YAML
name: Generate PDF
|
|
|
|
on:
|
|
# allows manual triggering
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- '**'
|
|
pull_request:
|
|
branches:
|
|
- '**'
|
|
|
|
jobs:
|
|
|
|
# runs on main branch pushes
|
|
build-and-deploy:
|
|
if: github.ref == 'refs/heads/main'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
pages: write
|
|
id-token: write
|
|
environment:
|
|
name: github-pages
|
|
url: ${{ steps.deployment.outputs.page_url }}
|
|
steps:
|
|
- name: Checkout Repo
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Build PDF
|
|
uses: xu-cheng/latex-action@v4
|
|
with:
|
|
root_file: M17_spec.tex
|
|
|
|
- name: Check PDF exists
|
|
run: |
|
|
if [ ! -f M17_spec.pdf ]; then
|
|
echo "PDF was not generated!" >&2
|
|
exit 1
|
|
fi
|
|
- name: Move PDF to public/
|
|
run: |
|
|
mkdir -p public
|
|
mv M17_spec.pdf public/
|
|
|
|
- name: Setup Pages
|
|
uses: actions/configure-pages@v4
|
|
|
|
- name: Upload PDF
|
|
uses: actions/upload-pages-artifact@v3
|
|
with:
|
|
path: public
|
|
|
|
- name: Deploy to Pages
|
|
uses: actions/deploy-pages@v4
|
|
|
|
- name: Post URL to Summary
|
|
run: echo "🚀 [View the latest PDF](https://m17-project.github.io/M17_spec/M17_spec.pdf)" >> $GITHUB_STEP_SUMMARY
|
|
|
|
# runs on PRs and non-main branch pushes
|
|
build-artifact-only:
|
|
if: github.ref != 'refs/heads/main'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Checkout Repo
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Build PDF
|
|
uses: xu-cheng/latex-action@v4
|
|
with:
|
|
root_file: M17_spec.tex
|
|
|
|
- name: Check PDF exists
|
|
run: |
|
|
if [ ! -f M17_spec.pdf ]; then
|
|
echo "PDF was not generated!" >&2
|
|
exit 1
|
|
fi
|
|
|
|
- name: Upload PDF artifact for branch/PR
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: M17_spec
|
|
path: M17_spec.pdf
|