Repository navigation
Add scripts/release.sh for releasing to PyPI by hand - #50
Merged
Merged
Conversation
publish.yml only uploads through PyPI trusted publishing, which has never run here, and the Bump version workflow can't open its release PR (the org doesn't allow GitHub Actions to create pull requests). The script covers both: optionally makes release/<next> from origin/main (--bump), checks the branch matches origin, the lockfile matches and the version is new, runs the tests, builds, twine-checks, uploads after asking, verifies a clean install from PyPI, and opens the release PR. `--tag` tags origin/main after the merge. `--dry-run` stops before anything leaves the machine. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Run from a temp copy: --bump switches branches, which can rewrite the script while bash is still reading it. - --bump plans from origin/main's files in a scratch folder and checks everything before switching, so a failed check no longer leaves you on a detached origin/main. - Only a 404 counts as "not on PyPI"; offline or PyPI errors stop the run instead of passing the "version is new" check. - No terminal and no --yes means "no" instead of a silent exit. - Tag the uploaded commit right after the upload (no separate step that could tag later, unreleased merges on main). --tag stays for catching up untagged releases and prefers the release branch head. - A failed PR creation after the upload prints the manual step. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
publish.ymlonly uploads through PyPI trusted publishing (never exercised: the upload job was skipped on every run, and no release on PyPI has a provenance record), andbump-version.ymlcan't open its release PR because the org doesn't allow GitHub Actions to create pull requests. This script does a release from a laptop.Usage
scripts/release.sh --tagtags a version that's on PyPI but untagged (e.g. 0.4.1: it picks the head oforigin/release/0.4.1, 57e8d35).Options:
--skip-tests,--yes(don't ask before uploading),--dry-run(no push, upload, PR or tag). Needsuv,gh, and a PyPI token in~/.pypircorTWINE_USERNAME/TWINE_PASSWORD.What it checks before uploading
origin/<branch>(so PyPI gets exactly what the PR merges), not onmainuv.lock's editablenitrostackversion matchespyproject.toml.[dev]), build,twine check --strict; asks y/N beforetwine uploadnitrostack==Xinto a fresh venv and imports itvX.Y.Zand pushes the tagrelease, so the bump workflow skips it;publish.ymlsees the version on PyPI and skips the upload)uvis found even when the pyenv shim fails inside this repo (the pinned.python-version3.12 isn't in pyenv).Testing (throwaway clone, nothing pushed or uploaded)
--bump patch --dry-run: maderelease/0.4.2fromorigin/main(onlypyproject.toml/uv.lockchanged), tests passed, built 0.4.2 wheel + sdist,twine checkpassed, stopped before upload.--tag --dry-run: "would tag origin/release/0.4.1 (57e8d35) as v0.4.1".--bumpwithrelease/0.4.2already present: fails and stays onmain, tree untouched.curl): "Couldn't check PyPI for 0.4.1 (HTTP 000)" instead of treating it as unpublished.main; uncommitted changes; branch not pushed; version already on PyPI (0.4.1); bad--bump.--bumpchecks the exact-version URL first and says so instead of failing oddly.Review fixes (2nd commit): runs from a temp copy (so
--bump's branch switch can't rewrite the running script), plans--bumpin a scratch folder, 404-only "not on PyPI", no-tty prompt means no, tag the uploaded commit instead oforigin/main, non-fatal PR creation.Not run for real: the upload, tag push and PR-creation steps (they'd publish).
🤖 Generated with Claude Code