Skip to content

[workflow] Enable trusted publishing - #59

Merged
gokulkrishna98 merged 7 commits into
apple:mainfrom
gokulkrishna98:dev/gokul/trusted_publishing
Aug 19, 2026
Merged

[workflow] Enable trusted publishing #59
gokulkrishna98 merged 7 commits into
apple:mainfrom
gokulkrishna98:dev/gokul/trusted_publishing

Conversation

@gokulkrishna98

@gokulkrishna98 gokulkrishna98 commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Description:

Add a tag-triggered release workflow that builds the wheel and sdist,
smoke-tests the built wheel on every supported Python version, and
uploads to PyPI with `uv publish --trusted-publishing always`. Only the
publish job holds `id-token: write`, and it runs no project code — it
just downloads the artifact the earlier jobs vetted.

Authentication is a short-lived OIDC token minted by GitHub Actions for
that one job, so no PyPI API token is stored in the repo or in an org
secret, and no developer holds a credential that can upload a release.
The publish job waits on the `pypi` GitHub environment, whose protection
rules (required reviewers with prevent-self-review, wait timer, `v*.*.*`
tag restriction) live in repo settings rather than in this file.

The build job fails if the pushed tag disagrees with __version__, since
PyPI uploads are immutable and cannot be replaced. RELEASE.md documents
the release steps and the one-time PyPI and GitHub configuration.

Mirrors the release workflow in apple/coreai-optimization.
- Skip the release run unless hosted on github.com: PyPI Trusted Publishing
  only accepts OIDC tokens minted there, so a tag push elsewhere would run
  build and smoke-test and then discard the result. smoke-test and publish
  inherit the skip through `needs: build`.
- Rebuild a wheel from the sdist in the build job. The sdist is published but
  never installed, so nothing caught a MANIFEST.in omission that breaks a
  build from source. Uses a scratch out-dir so dist/ stays as built.
- Correct the smoke-test comment, which claimed broader coverage than the
  wheel-only script provides.
@gokulkrishna98 gokulkrishna98 changed the title [wip] Enable trusted publishing [workflow] Enable trusted publishing Aug 18, 2026
@gokulkrishna98
gokulkrishna98 marked this pull request as ready for review August 18, 2026 20:30
Comment thread RELEASE.md Outdated
Comment thread .github/workflows/release.yml
Comment thread .github/workflows/release.yml
Comment thread RELEASE.md Outdated
@dengqiaoyu

Copy link
Copy Markdown

Nit: There is a file named release.sh. If we set up trusted publishing, we should remove the old publishing method once we confirm the new method works. This will prevent confusion for anyone who does a release in the future.

Comment thread RELEASE.md Outdated
@gokulkrishna98

Copy link
Copy Markdown
Contributor Author

Nit: There is a file named release.sh. If we set up trusted publishing, we should remove the old publishing method once we confirm the new method works. This will prevent confusion for anyone who does a release in the future.

Thanks, will remove it once verified that trusted publishing works.

Comment thread RELEASE.md Outdated
Swap `uv publish --trusted-publishing always` for the PyPA action, so the
upload path tracks PyPI protocol changes (attestation format, upload API)
directly. Attestations and metadata verification are on by default, and with
no `password` input the OIDC token is the only way it can authenticate.

`setup-uv` is no longer needed in the publish job, which now runs two steps:
download the artifact, upload it. `build` and `smoke-test` still use uv.
The step-by-step PyPI form walkthrough duplicated PyPI's own docs, which the
page already links. Keep only what those docs cannot state: that the publisher
must be bound to the `pypi` environment as well as the workflow, and what the
environment's protection rules are, since that is this project's release policy.

Also drops the claim that the configuration is already in place; it is not
created yet.
`/release stage1` is a local developer command, not something a reader of this
repo can run, and the docs deploy named a specific git remote that only exists
in one clone. Every command in this guide now refers to a file tracked here.
@gokulkrishna98
gokulkrishna98 force-pushed the dev/gokul/trusted_publishing branch from 0fec23a to b86d832 Compare August 19, 2026 16:59
gokulkrishna98 and others added 2 commits August 19, 2026 10:02
The workflow builds, tests, and publishes from the tag, so the tag is the trust
anchor for the whole release. Use `git tag -s` and confirm GitHub reports it as
Verified.
@gokulkrishna98
gokulkrishna98 merged commit 8fdedf2 into apple:main Aug 19, 2026
2 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.

3 participants