Skip to content

Fix imagemagick pdf policy #24

Fix imagemagick pdf policy

Fix imagemagick pdf policy #24

Workflow file for this run

on: [push]
jobs:
build-latex:
runs-on: ubuntu-latest
name: Build latex (print=${{ matrix.print }})
strategy:
matrix:
print: [true, false]
steps:
- name: Set up Git repository
uses: actions/checkout@v4
- id: cache-restore
uses: actions/cache/restore@v4
with:
path: Thesis/master.pdf
key: thesis-${{ hashFiles('Thesis') }}
- name: Configure print vs. digital
run: echo "\settoggle{print}{${{ matrix.print }}}" > Thesis/set_print_toggle.tex
- name: Compile LaTeX document
if: steps.cache-restore.outputs.cache-hit != 'true'
uses: xu-cheng/latex-action@v3
with:
working_directory: Thesis
root_file: master.tex
- uses: actions/cache/save@v4
with:
path: Thesis/master.pdf
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
- name: Upload PDF file
uses: actions/upload-artifact@v4
with:
name: PDF-${{ matrix.print && 'print' || 'digital' }}
path: Thesis/master.pdf
create-preview:
runs-on: ubuntu-24.04 # Fixes PDF not allowed policy in 22.04
needs: build-latex
steps:
- name: Download PDF
uses: actions/download-artifact@v4
with:
name: PDF-print
- name: Install imagemagick (convert)
run: |
sudo apt-get update
sudo apt-get install imagemagick
- name: Make montage
run: |
convert -density 150 "master.pdf[0,36,38,52]" -alpha remove -border 10x10 out.png
convert montage -geometry +5+5 out-* example.png
- uses: EndBug/add-and-commit@v9
with:
add: example.png
message: Generate example image
committer_name: GitHub Actions
committer_email: 41898282+github-actions[bot]@users.noreply.github.com
release:
runs-on: ubuntu-latest
needs: build-latex
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Rename files
run: mv PDF-print/master.pdf thesis-print.pdf && mv PDF-digital/master.pdf thesis-digital.pdf
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
thesis-print.pdf
thesis-digital.pdf