minor changes to trigger PDF workflow #4
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/**' | |
| 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: | | |
| 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 \ | |
| -V geometry:margin=1in \ | |
| --verbose | |
| done | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: output | |
| path: output | |
| pushpdfs: | |
| needs: makepdfs | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| 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 | |
| git commit -m "Auto update pdfs [skip ci]" -a | |
| git push | |
| fi |