Sync font packages #6
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: Sync font packages | |
| on: | |
| schedule: | |
| - cron: "17 6 * * 1" | |
| workflow_dispatch: | |
| inputs: | |
| families: | |
| description: "Space-separated family slugs (default: families.txt)" | |
| required: false | |
| default: "" | |
| publish: | |
| description: "Publish built wheels to PyPI (each fontpkg-<slug> needs a trusted publisher configured on PyPI)" | |
| type: boolean | |
| default: false | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: astral-sh/setup-uv@v10.0.1 | |
| with: | |
| python-version: "3.13" | |
| - run: uv sync --all-packages | |
| - name: Sync changed families | |
| # At full catalog scale, some families always fail transiently (GitHub | |
| # abuse-detection 403s under sustained load) or permanently (bad upstream | |
| # data). continue-on-error lets the job still commit whatever succeeded | |
| # instead of discarding an entire run's progress over a handful of misses. | |
| continue-on-error: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| if [ -n "${{ inputs.families }}" ]; then | |
| uv run fontpkg-gen sync ${{ inputs.families }} --state state.json --out build --wheel | |
| else | |
| uv run fontpkg-gen sync --families-file families.txt --state state.json --out build --wheel | |
| fi | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: font-wheels | |
| path: build/*/dist/*.whl | |
| if-no-files-found: ignore | |
| - name: Publish pending packages | |
| if: ${{ inputs.publish || (github.event_name == 'schedule' && vars.AUTO_PUBLISH == 'true') }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
| run: uv run fontpkg-gen publish-pending --state state.json --out build --priority-file families.txt | |
| - name: Commit updated state manifest and catalog | |
| run: | | |
| if ! git diff --quiet state.json catalog.json 2>/dev/null || [ -n "$(git ls-files --others state.json catalog.json)" ]; then | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add state.json catalog.json | |
| git commit -m "Update font state manifest and catalog" | |
| git push | |
| fi |