Repository navigation
ci: publish release binaries to PyPI as platform wheels - #4823
Conversation
Repackage the GitHub Release archives into platform wheels carrying wt and git-wt, and publish them with PyPI Trusted Publishing from the release environment. Reusing the archives keeps PyPI on the same bytes as every other channel, including the signed Windows binary. The wheel build runs on PRs against the latest release; publishing needs a trusted publisher configured on PyPI and is kept out of announce's needs. Refs #4822 Co-Authored-By: Claude <[email protected]>
worktrunk-bot
left a comment
There was a problem hiding this comment.
The PyPI project page will show a broken logo. The README opens with <img src="docs/public/logo.png" ...>, and this text becomes the long description unchanged. crates.io resolves relative image paths against the repository, but PyPI doesn't, so the image 404s on every release page. I'll push a fix that rewrites relative src/href targets to the release tag's raw GitHub URLs.
PyPI renders the long description without a base URL, so the README's relative logo src would show as a broken image. Point relative src/href targets at the release tag's raw GitHub content.
|
@worktrunk-bot Max wants to try this, labelled experimental. Please:
This merges once CI is green on the new head. The pending trusted publisher on PyPI is Max's to register; until it exists,
|
Co-authored-by: Claude <[email protected]>
Co-authored-by: Claude <[email protected]>
|
Done in 0c78523. CI went green on that head, including
Merge mode here is restricted, so I'll leave the merge to you. |
#4789 added a `workflow_dispatch` trigger with a `release_tag` input, so a run started from a trusted non-version tag could publish an existing version tag, plus plumbing that pinned every job to that tag's commit. The 0.82.0 recovery used it. Its keyless signing certificate names the run's own ref, `release.yaml@refs/tags/release-recovery-nov14`, instead of `refs/tags/v0.82.0`, so aqua, and mise's `aqua:` backend, refuse to install 0.82.0 (#4829). The trigger also lets anyone with write access start a run that reaches the `release` environment (#4797). This removes the trigger and its plumbing. `release.yaml` now matches its pre-#4789 form apart from #4805's packslip bump, #4823's PyPI jobs, and two `persist-credentials: false` lines (below). The macOS runner pins in `dist-workspace.toml` stay. A release whose workflow breaks now ships as the next patch version, and the release skill says so at the step that watches the run. To weigh: - The `release-recovery-nov14` tag is the only ref whose `release.yaml` still has the trigger, so a dispatch against it reaches `release` until an admin deletes the tag. `tend check` reads only the default branch, so it passes once this merges. - The `persist-credentials: false` lines #4789 added to the crates.io and AUR checkouts stay. They don't depend on the dispatch path, and both jobs passed with them in the recovery run. - #4823's `build-pypi-wheels` checked out `needs.plan.outputs.source-sha`. It now takes the default checkout, which is the version tag on a tag push and the PR ref on a PR, as it was for every job before #4789. Max chose this on a review page. Checks: `dist plan` (0.30.2) still puts the macOS targets on `macos-26` and `macos-26-intel`; actionlint reports the same 7 shellcheck findings as `main`; pre-commit passes. Closes #4797 > _This was written by Claude Code on behalf of max-sixty_
0.83.0 is the first release on PyPI (#4823), so the install docs can now list it. This adds a **PyPI (experimental)** entry under "Windows & other", after Conda / Pixi. It shows `uv tool install worktrunk@latest && wt config shell install`, then one line for the two uses #4822 asked for: listing `worktrunk` as a dependency, and `uvx --from worktrunk wt list` without installing. `@latest` makes a rerun of the line upgrade, as `brew install` and `cargo install` do for their entries. Without it, `uv tool install worktrunk` answers "`worktrunk` is already installed" and keeps the old version. I checked this with ruff in a scratch tool directory, because worktrunk has only one version on PyPI so far. `-U` behaves the same, but `@latest` is how Ruff's README writes its install line. The `uvx` line needs neither: an unpinned `uvx --from` resolved the newest version even with an older one cached. "Experimental" matches the note at the top of the package's PyPI description. #4823 deferred this until a version was actually on PyPI. I ran both commands against the published package in a scratch tool directory. Each printed `wt v0.83.0`, and `uv tool install` put `wt` and `git-wt` on the bin path. The README and both skill reference copies are regenerated from `docs/src/content/docs/worktrunk.md`, and `test_docs_are_in_sync` passes. > _This was written by Claude Code on behalf of max-sixty_
Adds a PyPI channel for the release, as requested in #4822:
uvx --from worktrunk wt,worktrunkas apyproject.tomldependency, and PEP 723 scripts. Instead of building with maturin, a new job turns the five GitHub Release archives into wheels withwtandgit-wtin the scripts directory. PyPI then ships the same bytes as GitHub Releases, Homebrew and winget, including the SignPath-signedwt.exe.Needs before the first publish: a pending trusted publisher on PyPI for project
worktrunk(still unregistered —pypi.org/pypi/worktrunk/jsonreturns 404), with ownermax-sixty, repoworktrunk, workflowrelease.yamland environmentrelease. Until that exists,publish-pypifails on the next release. That doesn't block the rest of the release, because the job isn't inannounce's needs.Changes
.github/build-wheels.py(stdlib only) reads eachworktrunk-<target>.{tar.xz,zip}and writesworktrunk-<version>-py3-none-<platform>.whlcontaining the two binaries plus METADATA (README as the description, with relative links pointed at the release tag so the logo renders on PyPI;License-Expression: MIT OR Apache-2.0), LICENSE, WHEEL and RECORD. The timestamps are fixed, so the same archives give identical wheels. It errors if any of the five targets is missing, or if the version isn't plainX.Y.Z.build-pypi-wheelsruns afterhost. It downloads the release archives, checks them against their.sha256files, builds the wheels, runstwine check --strict, and install-smoke-tests the Linux wheel. On PRs it runs against the latest release and doesn't publish, so the packaging gets exercised on every PR. That adds one ~100 MB download job per PR.publish-pypi(environmentrelease,id-token: write) uploads the wheels withpypa/gh-action-pypi-publish, pinned to the SHA of v1.14.3. Prereleases are skipped, as Homebrew skips them..claude/skills/release/SKILL.md) now lists AUR and PyPI (experimental) among the channelsrelease.yamlpublishes to..github/AGENTS.mdnow lists PyPI among thereleaseenvironment's OIDC uses.Platform tags: the Linux archives are static musl builds, so they get both
manylinux_2_17andmusllinux_1_1tags. macOS uses Rust's default floors (macosx_10_12_x86_64,macosx_11_0_arm64), and Windows useswin_amd64.Verification
I ran the job's steps locally against the v0.82.0 release assets: all five checksums matched, all five wheels passed
twine check --strict, and the x86_64 Linux wheel installed with pip,uv pipanduvx --from worktrunk wt --version. All three printedwt v0.82.0, and the installedwtis byte-identical to the one in the archive. I haven't installed the macOS or Windows wheels on those platforms. The publish step itself can only run on a release tag.Left for later
wt.exenext togit-wt.exe, so a script that runswtgets whicheverwtcomes first onPATH. In an activated venv or underuvxthat's the venv's copy.Closes #4822