updated version number to 1.2.3 #3
This file contains hidden or 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: create PDF workflow | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - '**.md' | |
| - '!.github/**' | |
| # Prevents multiple runs from overlapping | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| makepdfs: | |
| runs-on: ubuntu-latest | |
| container: | |
| image: docker://pandoc/latex:2.9 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: prepare output directories | |
| run: | | |
| for d in */; do | |
| mkdir -p output/"$d" | |
| done | |
| - name: create pdf file(s) | |
| run: | | |
| # The --pdf-engine=xelatex flag allows for Unicode characters like ≤ | |
| find . -type f \( -iname "*.md" ! -iname "README.md" \) | while read f; do | |
| pandoc "$f" -s -o "output/${f%.md}.pdf" \ | |
| --toc \ | |
| --number-sections \ | |
| --pdf-engine=xelatex \ | |
| --verbose | |
| done | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: output | |
| path: output | |
| pushpdfs: | |
| needs: makepdfs | |
| runs-on: ubuntu-latest | |
| # Explicitly grant permission to write (push) to the repository | |
| permissions: | |
| contents: write | |
| # Safety check to prevent the bot from triggering its own workflow | |
| if: github.actor != 'github-actions[bot]' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download all workflow run artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: output | |
| path: pdf | |
| - name: Add and commit files | |
| run: | | |
| git config --global user.name github-actions[bot] | |
| git config --global user.email github-actions[bot]@users.noreply.github.com | |
| git add pdf/*.pdf | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| else | |
| # [skip ci] tells GitHub not to run the workflow again for this specific commit | |
| git commit -m "Auto update pdfs [skip ci]" -a | |
| git push | |
| fi |