Skip to content

Publish to PyPI with trusted publishing - #103

Merged
iunir merged 6 commits into
mainfrom
publish-to-pypi-with-trusted-publishing
Nov 26, 2026
Merged

iunir merged 6 commits into
mainfrom
publish-to-pypi-with-trusted-publishing

Conversation

@iunir

@iunir iunir commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

What has changed and why?

Add a workflow that publishes labelformat to PyPI with trusted publishing. No API token is needed.

  • A published GitHub release starts the workflow.
  • You can also start it manually with a tag. Select testpypi to rehearse a release.
  • The build job checks that the tag matches the version in pyproject.toml. This job cannot get a PyPI credential.
  • The publish job uploads the distributions with attestations.

The setup is the same as the LightlyStudio release workflow.

.github/RELEASE.md explains how to release, and README.md links to it.

Before the first release, do these steps:

  1. On PyPI, add a trusted publisher to labelformat: owner lightly-ai, repository labelformat, workflow publish.yml, environment pypi.
  2. On TestPyPI, do the same with environment testpypi.
  3. In the repository settings, create the pypi and testpypi environments. Add required reviewers to pypi if you want an approval gate.

How has it been tested?

  • actionlint passes.
  • uv build makes the wheel and the sdist for 0.1.18. The version check reads 0.1.18, which matches tag v0.1.18.
  • Not run in CI yet. After the setup, start the workflow manually with testpypi to test it.

Pin actions to commit SHAs, check that the tag is on main, build with
Python 3.12, keep the build artifact for 30 days, and scope concurrency
per index. Document the environment protection, the TestPyPI setup, and
that pre-releases publish to PyPI.
@iunir

iunir commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

/review

Comment thread .github/RELEASE.md Resolved
Comment thread .github/workflows/publish.yml Resolved
Comment thread .github/workflows/publish.yml Resolved
Comment thread .github/workflows/publish.yml Resolved
Keep the build artifact for a day, build with Python 3.15, explain the
/legacy/ upload URL, and say how to approve the deployment.
The environments exist already. Keep only why their protection must stay.
@iunir
iunir merged commit 3cc3f96 into main Nov 26, 2026
2 checks passed
@iunir
iunir deleted the publish-to-pypi-with-trusted-publishing branch November 26, 2026 08:58
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