Skip to content

Commit

Permalink
try gh action
Browse files Browse the repository at this point in the history
  • Loading branch information
triszt4n committed Sep 18, 2024
1 parent 0355e01 commit 21e835d
Showing 1 changed file with 36 additions and 34 deletions.
70 changes: 36 additions & 34 deletions .github/workflows/generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: sergeysova/jq-action@v2
id: find
with:
cmd: |
cmd: |
find . -mindepth 1 -name "*.tex" |
jq -R -s -c 'split("\n")[:-1]' |
sed 's/"/\\"/g'
Expand All @@ -28,7 +28,7 @@ jobs:
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
Expand All @@ -39,47 +39,49 @@ jobs:
matrix:
path: ${{ fromJson(needs.build-matrix.outputs.matrix) }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4

- name: Change directory
run: cd $(dirname ${{ matrix.path }})
- name: Get dir of file
id: get-dir
run: echo "dir=$(dirname ${{ matrix.path }})" >> $GITHUB_OUTPUT

- name: Convert to pdf
id: convert-to-pdf
uses: xu-cheng/latex-action@v3
with:
root_file: ${{ matrix.path }}
- name: Compile LaTeX document
uses: xu-cheng/latex-action@v2
with:
working_directory: ${{ steps.get-dir.outputs.dir }}
root_file: ${{ matrix.path }}
latexmk_shell_escape: true

- name: Find PDF
id: find-pdf
run: |
find $(dirname ${{ matrix.path }}) -maxdepth 1 -name '*.pdf' -exec echo "pdf={}" >> $GITHUB_OUTPUT \;
echo "artifact=$(basename ${{ matrix.path }}))" >> $GITHUB_OUTPUT
- name: Find PDF
id: find-pdf
run: |
find $(dirname ${{ matrix.path }}) -maxdepth 1 -name '*.pdf' -exec echo "pdf={}" >> $GITHUB_OUTPUT \;
echo "artifact=$(basename ${{ matrix.path }}))" >> $GITHUB_OUTPUT
- name: Store pdf
uses: actions/upload-artifact@v4
with:
name: ${{ steps.find-pdf.outputs.artifact }}
path: ${{ steps.find-pdf.outputs.pdf }}
retention-days: 1
- name: Store pdf
uses: actions/upload-artifact@v4
with:
name: ${{ steps.find-pdf.outputs.artifact }}
path: ${{ steps.find-pdf.outputs.pdf }}
retention-days: 1

collect-artifacts:
runs-on: ubuntu-latest
needs:
- build-szmsz
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: downloaded
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: downloaded

- name: Place artifacts
run: rsync -av downloaded/*/*/ pdfs/
- name: Place artifacts
run: rsync -av downloaded/*/*/ pdfs/

- name: Store pdf
uses: actions/upload-artifact@v4
with:
name: pdfs
path: pdfs/
retention-days: 90
- name: Store pdf
uses: actions/upload-artifact@v4
with:
name: pdfs
path: pdfs/
retention-days: 90

0 comments on commit 21e835d

Please sign in to comment.