Title: [CI] Release workflow: publish to PyPI from GitHub Actions by PetrHeinz · Pull Request #48 · logtail/logtail-python · GitHub
Open Graph Title: [CI] Release workflow: publish to PyPI from GitHub Actions by PetrHeinz · Pull Request #48 · logtail/logtail-python
X Title: [CI] Release workflow: publish to PyPI from GitHub Actions by PetrHeinz · Pull Request #48 · logtail/logtail-python
Description: logtail-python is still released by hand: bump two files, create a PyPI token, write ~/.pypirc, build, twine upload. This adds a Release workflow modelled on the one logtail-js got in logtail-js#154: manually dispatched from master with patch, minor or retry, plus a dry_run switch.
What a run does:
verify runs the test suite on the latest Python.
build bumps the version in setup.py and logtail/__init__.py (they must agree, the step refuses otherwise), builds the sdist and the wheel, runs twine check, and only then commits vX.Y.Z, tags it and pushes both to master. A failed build therefore pushes nothing.
release runs in the pypi environment, uploads the two files with pypa/gh-action-pypi-publish and creates a GitHub release with generated notes for the tag, idempotently.
retry finishes a release whose version commit is already HEAD: no bump, rebuild, upload with skip-existing, create the release if it is missing. patch and minor refuse to run when HEAD is already tagged as the current version, so a double dispatch cannot release an empty version.
Authentication: the repository secret PYPI_TOKEN_PASSWORD is used whenever it exists. When it is absent, the publish action switches to trusted publishing (OIDC) by itself, and the dry run then proves that the trusted publisher on pypi.org matches this workflow by exchanging the OIDC token without uploading anything. With the token set, the dry run stops after building, since a token cannot be verified without uploading. Trusted publishing is what logtail-js uses and what gets PEP 740 attestations on PyPI, so it is worth switching to at some point: add a GitHub publisher on the logtail-python project on pypi.org (owner logtail, repository logtail-python, workflow release.yml, environment pypi) and delete the secret.
Before the first run:
Create the pypi environment with required reviewers and deployment branches limited to master. A job that references a missing environment creates it without protection.
Merge first: workflow_dispatch only lists workflows present on the default branch. Then dispatch a dry run, then the real release.
Verified locally: the YAML parses, every shell block passes bash -n, python -m build and twine check produce exactly logtail_python-
Open Graph Description: logtail-python is still released by hand: bump two files, create a PyPI token, write ~/.pypirc, build, twine upload. This adds a Release workflow modelled on the one logtail-js got in logtail-js#15...
X Description: logtail-python is still released by hand: bump two files, create a PyPI token, write ~/.pypirc, build, twine upload. This adds a Release workflow modelled on the one logtail-js got in logtail-js#15...
Opengraph URL: https://github.com/logtail/logtail-python/pull/48
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:826d3439-4286-ea05-71c6-450c915bd451 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | DDF0:10A7CF:19D86D:22346F:6AFBB1AF |
| html-safe-nonce | 7fe0dbbb73c6354fc5bf48d7bfda75803024a6bdf37dc726434bc4543555ef04 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEREYwOjEwQTdDRjoxOUQ4NkQ6MjIzNDZGOjZBRkJCMUFGIiwidmlzaXRvcl9pZCI6IjU2OTAwNjYyOTI5Mzc4MzA4MzEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 1c645fe910b6ee356aaec39a59ad07823f9deebd9583ccd7938d0ebefb9089c3 |
| hovercard-subject-tag | pull_request:4627078281 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/logtail/logtail-python/pull/48/files |
| twitter:image | https://avatars.githubusercontent.com/u/10008612?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/10008612?s=400&v=4 |
| og:image:alt | logtail-python is still released by hand: bump two files, create a PyPI token, write ~/.pypirc, build, twine upload. This adds a Release workflow modelled on the one logtail-js got in logtail-js#15... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2b2ef9c1578c18d8ed27027940544c958743213cf4461659f14d3ccdf51e162c |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/logtail/logtail-python git https://github.com/logtail/logtail-python.git |
| octolytics-dimension-user_id | 78922349 |
| octolytics-dimension-user_login | logtail |
| octolytics-dimension-repository_id | 351343852 |
| octolytics-dimension-repository_nwo | logtail/logtail-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 351343852 |
| octolytics-dimension-repository_network_root_nwo | logtail/logtail-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e4cce0e99cf61481a318ff12c2e8580153a6c7c6 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width