Energieeffizienz #26
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: 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 | |
xelatex -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 |