Fix prerelease versioning by mirroring PEP 440 tags to semver - #610
Merged
Conversation
semantic-release computes semver versions, but uv normalizes prerelease versions to PEP 440 when cutting them, so the tag it produces (v3.0.0b1) is not valid semver. semantic-release silently skips tags it cannot parse, so every run on a prerelease branch reported the channel's first prerelease as the next version and tried to cut a version that had already been published. Mirror each PEP 440 prerelease tag onto its semver equivalent before running semantic-release. The mirrored tags are local to the workflow run, so the PEP 440 tags stay the only real ones and continue to match the published package version. Recording the channel a prerelease went out on, which semantic-release requires before it will treat a prerelease tag as released, stays in the Version workflow where the release is cut. It now keys the note to the PEP 440 tag that actually gets created, rather than to a semver tag name that never exists, and derives the channel from the normalized version so a release cut by hand is recorded the same way. Notes attach to commits rather than tags, so the mirrored tag picks the channel up. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WKRv7ht6XA9Sm8brKctEva
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.
Summary
This PR fixes the prerelease release workflow to properly handle the mismatch between PEP 440 version format (used by the published package) and semantic versioning (expected by semantic-release). The changes ensure that semantic-release can correctly track prerelease versions and determine the next version to release.
Key Changes
Version workflow (
version.yml): Updated the prerelease channel recording to use the normalized PEP 440 version fromuv version --shortinstead of parsing the input version string. Changed from a single shared notes reference to per-tag notes references (semantic-release-$tag), which allows each prerelease tag to maintain its own channel metadata.Semantic release workflow (
semantic-release.yml): Added a new "Mirror prerelease tags as semver" step that converts PEP 440 prerelease tags (e.g.,v3.0.0b1) to their semantic versioning equivalents (e.g.,v3.0.0-beta.1) before running semantic-release. These mirrored tags are local to the workflow run and are never pushed; they exist only to allow semantic-release to parse and understand prerelease versions.Implementation Details
a,b,rc) to semantic versioning format (-alpha.,-beta.,-rc.)https://claude.ai/code/session_01WKRv7ht6XA9Sm8brKctEva