Skip to content

Fix prerelease versioning by mirroring PEP 440 tags to semver - #610

Merged
razor-x merged 1 commit into
betafrom
claude/semantic-release-python-beta-rhdxws
Aug 13, 2026
Merged

Fix prerelease versioning by mirroring PEP 440 tags to semver#610
razor-x merged 1 commit into
betafrom
claude/semantic-release-python-beta-rhdxws

Conversation

@razor-x

@razor-x razor-x commented Aug 13, 2026

Copy link
Copy Markdown
Member

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 from uv version --short instead 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

  • The mirroring uses sed patterns to convert PEP 440 suffixes (a, b, rc) to semantic versioning format (-alpha., -beta., -rc.)
  • Channel notes are now keyed to specific tags rather than a global reference, preventing conflicts between different prerelease channels
  • The solution preserves the PEP 440 tags as the canonical versions in the repository while allowing semantic-release to work with semver-compatible representations
  • Git notes attached to commits apply to both the original PEP 440 tag and its mirrored semver equivalent, ensuring channel metadata is available to semantic-release

https://claude.ai/code/session_01WKRv7ht6XA9Sm8brKctEva

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
@razor-x
razor-x marked this pull request as ready for review August 13, 2026 08:10
@razor-x
razor-x requested a review from a team as a code owner August 13, 2026 08:10
@razor-x
razor-x merged commit ff0b518 into beta Aug 13, 2026
20 checks passed
@razor-x
razor-x deleted the claude/semantic-release-python-beta-rhdxws branch August 13, 2026 08:10
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