Build PDFs by Region #21
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: Build PDFs by Region | |
| # Produces the deployment PDFs. The build logic lives in | |
| # scripts/build_pdfs.py (a tested script -- tests/test_build_pdfs.py | |
| # runs the script on every PR with pandoc mocked); this workflow is | |
| # just the trigger + system-package install + upload. | |
| # | |
| # scripts/build_pdfs.py and scripts/build_zips.py both import the | |
| # complete-cultures filter from scripts/culture_completeness.py, so the | |
| # two pipelines ship the same set. The cross-check that data/countries.json | |
| # (the website-map registry) stays in lockstep with that set lives in | |
| # tests/test_culture_completeness_alignment.py. | |
| on: | |
| workflow_call: | |
| inputs: | |
| release: | |
| description: 'Cultures release tag to attach the PDFs to' | |
| type: string | |
| required: false | |
| default: '' | |
| workflow_dispatch: | |
| inputs: | |
| release: | |
| description: 'Release tag to attach the PDFs to (blank = artifacts only)' | |
| required: false | |
| default: '' | |
| release: | |
| types: [created] | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update -q | |
| sudo apt-get install -y pandoc | |
| pip install weasyprint | |
| - name: Build PDFs | |
| run: python scripts/build_pdfs.py dist | |
| # The release tag comes from the release event, or the input when | |
| # called by auto-release.yml / dispatched manually. With a tag, the | |
| # PDFs attach to that release; without one, they go to artifacts. | |
| - name: Resolve release tag | |
| id: rel | |
| env: | |
| EVENT_TAG: ${{ github.event.release.tag_name }} | |
| INPUT_TAG: ${{ inputs.release }} | |
| run: echo "tag=${EVENT_TAG:-$INPUT_TAG}" >> "$GITHUB_OUTPUT" | |
| - name: Attach to release | |
| if: steps.rel.outputs.tag != '' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.rel.outputs.tag }} | |
| files: dist/*.pdf | |
| - name: Upload as artifacts | |
| if: steps.rel.outputs.tag == '' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cultures-pdfs | |
| path: dist/*.pdf | |
| retention-days: 14 |