Skip to content

Publish releases to PyPI with Trusted Publishing - #36

Merged
waddell merged 1 commit into
maintenance/packaging-cifrom
ci/publish-workflow
Oct 22, 2026
Merged

waddell merged 1 commit into
maintenance/packaging-cifrom
ci/publish-workflow

Conversation

@smmaurer

Copy link
Copy Markdown
Member

Adds automated publishing to PyPI through Trusted Publishing, using the same workflow as UrbanSim and Orca. Stacked on #35. It targets that branch for now and will be retargeted to main once #35 merges.

.github/workflows/publish.yml (urbansim's, with osmnet names and the [test] extra)

  • Runs when a GitHub release is published. It builds the sdist and wheel, runs twine check --strict, installs the wheel, and runs the tests against it from outside the checkout. The tests and the saved Overpass responses are copied into the installed package; the live API tests are skipped.
  • Checks the wheel's version against the release tag (v0.2 ↔ 0.2), and checks that pre-release versions (rcN) go with pre-release GitHub releases and final versions with final ones.
  • Uploads through Trusted Publishing in the pypi environment, which waits for approval from a required reviewer. id-token: write is granted only to that job. skip-existing lets a re-run finish a partial upload.
  • workflow_dispatch builds and tests without publishing. Merging to main never publishes.
  • The one-time setup is done: the pypi environment has required reviewers, and the trusted publisher (UDST/osmnet, publish.yml, pypi) is registered on PyPI.

CONTRIBUTING.md: the PyPI section now describes the automated release, with the manual twine upload as the fallback.

Version 0.2.dev1, plus a changelog bullet.

Verified locally: actionlint is clean, and the build and wheel-test step, run with the same commands, gives 47 passed and 3 skipped (live) from the installed wheel. After merging, a workflow_dispatch dry run on main will exercise the build path, as with Orca; the release path (version check, approval, upload) is first exercised by 0.2rc1.

Add the Publish workflow used in urbansim and orca. On a published
GitHub release it builds the sdist and wheel, runs twine check
--strict, installs the wheel and runs the tests against it from outside
the checkout (copying the tests and saved Overpass responses into the
installed package), checks the version against the tag and the
pre-release flag, and uploads through Trusted Publishing after approval
in the pypi environment. workflow_dispatch builds and tests without
publishing. CONTRIBUTING.md describes the automated release, with the
manual upload as the fallback. Version 0.2.dev1.
@smmaurer
smmaurer requested a review from waddell October 21, 2026 23:55

@waddell waddell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ready to merge

@waddell
waddell merged commit 51da77e into maintenance/packaging-ci Oct 22, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants