Skip to content

Publish to PyPI automatically when a version bump merges - #310

Merged
MrOlm merged 1 commit into
masterfrom
claude/cloud-persistence-sessions-bybcsb
Sep 30, 2026
Merged

MrOlm merged 1 commit into
masterfrom
claude/cloud-persistence-sessions-bybcsb

Conversation

@MrOlm

@MrOlm MrOlm commented Sep 30, 2026

Copy link
Copy Markdown
Owner

Summary

Adds .github/workflows/publish.yml, which publishes dRep to PyPI whenever a merged PR bumps drep/VERSION.

  • Trigger: runs after the Tests workflow succeeds on a push to master. A failing test run never publishes. It can also be run by hand from the Actions tab.
  • Version check: reads drep/VERSION and asks PyPI whether that version already exists. If it does, the workflow stops. So merges that don't bump the version do nothing.
  • Publish: builds the sdist and wheel, runs twine check, and uploads with PyPI trusted publishing. No API token is stored in the repo.
  • Release: tags vX.Y.Z and creates a GitHub release with the built files attached. The release notes are that version's section of CHANGELOG.md.

One-time setup needed before merging

On PyPI, go to drep → Manage → Publishing → Add a new publisher → GitHub. Enter owner MrOlm, repository drep, workflow publish.yml, environment pypi. Until this is in place, the upload step will fail with an authentication error.

Heads-up

PyPI's latest drep is 4.0.0; 4.0.1 was never uploaded. master is at 4.0.2, so the first run after this merges will publish 4.0.2 (which includes the 4.0.1 changes). 4.0.1 will be skipped on PyPI.

Testing

  • actionlint passes on both workflows.
  • python -m build produces drep-4.0.2.tar.gz and drep-4.0.2-py3-none-any.whl, and twine check passes. It warns that there's no long description; that was already the case.
  • The PyPI check returns 200 for drep/4.0.0 and 404 for drep/4.0.2, as expected.
  • The CHANGELOG extraction correctly pulls just the 4.0.2 section.
  • The workflow itself can't run until it's on master, so the first real run will happen after the merge.

🤖 Generated with Claude Code

https://claude.ai/code/session_013UpcPFwkh6QMusnD6ApThL


Generated by Claude Code

Add a workflow that runs after Tests passes on a push to master. If
drep/VERSION holds a version that isn't on PyPI yet, it builds the sdist
and wheel, publishes them with PyPI trusted publishing, and tags a GitHub
release whose notes are that version's CHANGELOG section. Merges that
don't bump the version do nothing. It can also be run by hand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013UpcPFwkh6QMusnD6ApThL
@MrOlm
MrOlm merged commit dbb615b into master Sep 30, 2026
4 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.

2 participants