-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (35 loc) · 1.01 KB
/
tex_compile.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: LaTeX Build
on:
push:
paths:
- '**/*.tex'
pull_request:
paths:
- '**/*.tex'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Install LaTeX
run: sudo apt-get install texlive-full
- name: Compile LaTeX Documents
run: |
for file in $(find . -name '*.tex'); do
# Check if the file contains \documentclass (indicating a standalone document)
if grep -q '\\documentclass' "$file"; then
# Change directory to the file's location
cd "$(dirname "$file")"
# Compile the LaTeX document
pdflatex -halt-on-error "$(basename "$file")"
if [ $? -ne 0 ]; then
echo "Compilation failed for $file"
exit 1
fi
# Return to the root directory
cd - > /dev/null
else
echo "Skipping $file as it is not a standalone document."
fi
done