Debian Codegraph @

.github/workflows/deploy.yml

raw symbols SCIP
1 # Publish the package: to PyPI when a release is published, or to
2 # TestPyPI via a manual "Run workflow" dispatch (any branch) for dry-runs.
3 # Publishing uses PyPI trusted publishing (OIDC) — no API tokens.
4 #
5 # NOTE: keep this filename (deploy.yml) — the PyPI and TestPyPI trusted
6 # publishers are configured against it; renaming the file breaks
7 # publishing until the publishers are updated on both indexes.
8
9 name: Upload Python Package
10
11 on:
12 release:
13 types: [published]
14 # Manual TestPyPI dry-run from the Actions tab or
15 # `gh workflow run deploy.yml --ref <branch>`.
16 workflow_dispatch:
17
18 permissions:
19 contents: read
20
21 jobs:
22 # Re-run the full CI (lint + test matrix) on the exact ref being
23 # published, so a release or dry-run can't ship untested code.
24 ci:
25 uses: ./.github/workflows/ci.yml
26 permissions:
27 contents: read
28 publish:
29 needs:
30 - ci
31 runs-on: ubuntu-latest
32 timeout-minutes: 10
33 permissions:
34 id-token: write
35 steps:
36 - uses: actions/checkout@v4
37 - name: Set up Python
38 uses: actions/setup-python@v5
39 with:
40 python-version: "3.13"
41 # Building needs only Poetry itself (poetry-core backend) — no
42 # dependency install, no git history.
43 - uses: snok/install-poetry@v1
44 - name: Build package
45 run: poetry build
46 - name: Publish package
47 uses: pypa/[email protected]
48 with:
49 repository-url: ${{ github.event_name == 'release' && 'https://upload.pypi.org/legacy/' || 'https://test.pypi.org/legacy/' }}