diff --git a/.github/workflows/compile-and-push-tex.yml b/.github/workflows/compile-and-push-tex.yml index 20c0e3e5..791f3d22 100644 --- a/.github/workflows/compile-and-push-tex.yml +++ b/.github/workflows/compile-and-push-tex.yml @@ -11,6 +11,8 @@ concurrency: group: ${{ github.ref }} # Group by branch reference (e.g., 'refs/heads/main') cancel-in-progress: true +permissions: + contents: write jobs: build: @@ -18,26 +20,39 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - - name: Install LaTeX (pdflatex) - run: sudo apt-get update && sudo apt-get install -y texlive-latex-base texlive-latex-extra texlive-fonts-recommended texlive-fonts-extra texlive-science - - - name: Compile PDFs - run: cd docs && make - - - name: Commit changes + - name: Get changed LaTeX files + id: latex-files run: | - git config --global user.name "github-actions" - git config --global user.email "github-actions@github.com" - git add . - git commit -m "Add generated PDF files" || echo "No changes to commit" - - - name: Push changes - run: | - git push origin $GITHUB_REF - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} -- docs/**/*.tex | xargs) + echo "Changed files: $CHANGED_FILES" + echo "CHANGED_FILES=$CHANGED_FILES" >> $GITHUB_ENV + CHANGED_FILENAMES=$(for file in $CHANGED_FILES; do basename "$file"; done | xargs) + echo "CHANGED_FILENAMES=$CHANGED_FILENAMES" >> $GITHUB_ENV + FILE_COUNT=$(echo $CHANGED_FILENAMES | wc -w) + if [ $FILE_COUNT -gt 1 ]; then + PLURAL_S='s' + else + PLURAL_S='' + fi + echo "PLURAL_S=$PLURAL_S" >> $GITHUB_ENV + - uses: xu-cheng/texlive-action@v2 + name: Compile LaTeX Files + with: + scheme: full + texlive_version: 2024 + run: | + apk add make + cd docs + for file in ${{ env.CHANGED_FILES }}; do + dir=$(dirname "$file" | cut -d'/' -f2-) + make -B "$dir/$(basename "$file" .tex).pdf" + done + - name: Commit and push PDFs + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: 'Add/Update PDF${{ env.PLURAL_S }} for changed LaTeX file${{ env.PLURAL_S }}: ${{ env.CHANGED_FILENAMES }}' + file_pattern: 'docs/*.pdf' + branch: main \ No newline at end of file diff --git a/docs/Design/SoftDetailedDes/MIS.tex b/docs/Design/SoftDetailedDes/MIS.tex index 1e88b9e8..73fed99b 100644 --- a/docs/Design/SoftDetailedDes/MIS.tex +++ b/docs/Design/SoftDetailedDes/MIS.tex @@ -20,6 +20,7 @@ \usepackage{caption} \usepackage{fullpage} + \hypersetup{ bookmarks=true, % show bookmarks bar? colorlinks=true, % false: boxed links; true: colored links