lets try this #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate PDFs | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build-matrix: | |
name: Build matrix | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Get all files with .tex | |
uses: sergeysova/jq-action@v2 | |
id: find | |
with: | |
cmd: | | |
find . -mindepth 1 -name "*.tex" | | |
jq -R -s -c 'split("\n")[:-1]' | | |
sed 's/"/\\"/g' | |
- name: Setup matrix | |
id: set-matrix | |
run: echo "matrix=${{ steps.find.outputs.value }}" >> $GITHUB_OUTPUT | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
build-szmsz: | |
runs-on: ubuntu-latest | |
name: Create document | |
needs: | |
- build-matrix | |
strategy: | |
fail-fast: false # Continue with other directories if one fails | |
matrix: | |
path: ${{ fromJson(needs.build-matrix.outputs.matrix) }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Get dir of file | |
id: get-dir | |
run: | | |
echo "dir=$(dirname ${{ matrix.path }})" >> $GITHUB_OUTPUT | |
echo "artifact=$(basename ${{ matrix.path }})" >> $GITHUB_OUTPUT | |
- name: Compile LaTeX document | |
uses: xu-cheng/latex-action@v2 | |
with: | |
working_directory: ${{ steps.get-dir.outputs.dir }} | |
root_file: ${{ steps.get-dir.outputs.artifact }} | |
latexmk_shell_escape: true | |
- name: Find PDF | |
id: find-pdf | |
run: | | |
find $(dirname ${{ matrix.path }}) -maxdepth 1 -name '*.pdf' -exec echo "pdf={}" >> $GITHUB_OUTPUT \; | |
- name: Store pdf | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.get-dir.outputs.artifact }} | |
path: ${{ steps.find-pdf.outputs.pdf }} | |
retention-days: 1 | |
collect-artifacts: | |
name: Collect artifacts | |
runs-on: ubuntu-latest | |
needs: | |
- build-szmsz | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: downloaded | |
- name: Store pdf | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pdfs | |
path: downloaded/ | |
retention-days: 90 |