Skip to content

Comments

fix: beta workflow no longer auto-bumps minor version#673

Merged
dsarno merged 3 commits intoCoplayDev:betafrom
dsarno:fix/beta-release-versioning
Feb 3, 2026
Merged

fix: beta workflow no longer auto-bumps minor version#673
dsarno merged 3 commits intoCoplayDev:betafrom
dsarno:fix/beta-release-versioning

Conversation

@dsarno
Copy link
Collaborator

@dsarno dsarno commented Feb 3, 2026

Summary

  • Beta release workflow now bumps patch instead of minor when creating beta versions
  • Release workflow now has a "none" option to release beta version as-is
  • Release workflow displays version status at start showing main/beta versions
  • Removed redundant β character from Unity editor version badge

Problem

Previously, beta-release.yml auto-bumped the minor version when creating a beta (e.g., 9.3.19.4.0-beta.1). This forced every release to be at least a minor bump, making patch releases impossible.

Solution

beta-release.yml

  • Beta now bumps patch: 9.3.19.3.2-beta.1
  • If already a beta, increment beta number: 9.3.2-beta.19.3.2-beta.2
  • Changed from already_beta to needs_update flag - compares computed vs current version to determine if update needed
  • PyPI versioning now detects existing prereleases and keeps the same base version (prevents 9.3.2bXXX9.3.3bXXX on consecutive runs)

release.yml

  • Added none bump option to release beta version as-is after stripping suffix
  • Version status display shows main/beta versions and computed release version
  • Preview step outputs stripped_version to ensure consistency
  • Compute step uses previewed value for "none" option with sanity check

Unity Editor

  • Removed β suffix from version badge (redundant now that version includes -beta.N)

Version Flow Examples

Scenario Result
Stable 9.3.1 → beta 9.3.2-beta.1
Beta 9.3.2-beta.1 → next push 9.3.2-beta.2
Release with none 9.3.2
Release with patch 9.3.3
Release with minor 9.4.0

Test plan

  • Verify beta-release workflow creates correct version format on push to beta
  • Verify consecutive beta pushes increment beta number (not patch)
  • Verify release workflow shows version status in logs
  • Verify "none" option releases the stripped beta version as-is
  • Verify Unity editor shows version without extra β character

🤖 Generated with Claude Code

Changes to beta-release.yml:
- Beta now bumps patch instead of minor (9.3.1 → 9.3.2-beta.1)
- Allows patch releases without being forced into minor bumps
- Increment beta number if already a beta version

Changes to release.yml:
- Added "none" bump option to release beta version as-is
- Added version status display showing main/beta versions and
  what the release version will be

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Feb 3, 2026

Reviewer's Guide

Adjusts the beta and release GitHub workflows so beta builds bump patch instead of minor, adds a "none" release bump option, and surfaces main/beta version status before releasing.

Flow diagram for beta-release version calculation

flowchart TD
  Start([Start beta-release beta version computation]) --> GetCurrent[Read CURRENT_VERSION from MCPForUnity/package.json]

  GetCurrent --> CheckBeta{Does CURRENT_VERSION match base-beta pattern?<br/>e.g. X.Y.Z-beta.N}

  CheckBeta -- yes --> ParseBeta[Extract BASE_VERSION and BETA_NUM using regex captures]
  ParseBeta --> IncBeta[Compute NEXT_BETA = BETA_NUM + 1]
  IncBeta --> BuildBeta[Build BETA_VERSION = BASE_VERSION-beta.NEXT_BETA]
  BuildBeta --> OutputBeta[Set unity_beta_version to BETA_VERSION<br/>and already_beta to true]

  CheckBeta -- no --> CheckStable{Does CURRENT_VERSION match stable pattern?<br/>e.g. X.Y.Z}

  CheckStable -- yes --> ParseStable[Extract MAJOR, MINOR, PATCH using regex captures]
  ParseStable --> IncPatch[Compute NEXT_PATCH = PATCH + 1]
  IncPatch --> BuildStableBeta[Build BETA_VERSION = MAJOR.MINOR.NEXT_PATCH-beta.1]
  BuildStableBeta --> OutputStableBeta[Set unity_beta_version to BETA_VERSION<br/>and already_beta to false]

  CheckStable -- no --> Error[Fail with error: cannot parse CURRENT_VERSION]

  OutputBeta --> End([Done])
  OutputStableBeta --> End
  Error --> End
Loading

Flow diagram for release workflow version selection with none option

flowchart TD
  Start([Start release workflow]) --> ShowVersions[Show current version status
for main and beta]

  ShowVersions --> ReadInput[Read version_bump input
options: patch, minor, major, none]

  ReadInput --> FetchVersions[Fetch MAIN_VERSION and MAIN_PYPI from main
Fetch BETA_VERSION and BETA_PYPI from beta]

  FetchVersions --> StripBeta[Strip beta suffix from BETA_VERSION
STRIPPED = BETA_VERSION without -beta.N]

  StripBeta --> Preview{version_bump value?}

  Preview -->|none| PreviewNone[Preview release as STRIPPED
Release version will be STRIPPED]
  Preview -->|patch/minor/major| PreviewBump[Preview bumped version
by incrementing STRIPPED]

  PreviewNone --> Merge[Merge beta into main]
  PreviewBump --> Merge

  Merge --> GetCurrent[Read CURRENT_VERSION from MCPForUnity/package.json
on main]

  GetCurrent --> DecideFinal{version_bump value?}

  DecideFinal -->|none| UseCurrent[Set NEW_VERSION = CURRENT_VERSION
Release as-is after beta suffix strip]

  DecideFinal -->|patch| BumpPatch[Increment PATCH component]
  DecideFinal -->|minor| BumpMinor[Increment MINOR, reset PATCH to 0]
  DecideFinal -->|major| BumpMajor[Increment MAJOR, reset MINOR and PATCH to 0]

  BumpPatch --> BuildNew[Build NEW_VERSION from components]
  BumpMinor --> BuildNew
  BumpMajor --> BuildNew

  UseCurrent --> Output[Output NEW_VERSION and current_version]
  BuildNew --> Output

  Output --> End([Publish release artifacts])
Loading

Flow diagram for PyPI beta version computation in beta-release workflow

flowchart TD
  Start([Start PyPI beta version computation]) --> ReadRaw[Read RAW_VERSION from Server/pyproject.toml]

  ReadRaw --> StripSuffix[Strip any existing pre-release suffix<br/>BASE_VERSION]

  StripSuffix --> ValidateBase{Is BASE_VERSION in X.Y.Z format?}

  ValidateBase -- no --> Error[Fail with error: could not parse version]

  ValidateBase -- yes --> ParseBase[Parse MAJOR, MINOR, PATCH from BASE_VERSION]

  ParseBase --> IncPatch[Compute NEXT_PATCH = PATCH + 1]

  IncPatch --> GenBetaNum[Generate BETA_NUMBER from timestamp]

  GenBetaNum --> BuildBeta[Build BETA_VERSION = MAJOR.MINOR.NEXT_PATCHbBETA_NUMBER]

  BuildBeta --> Output[Log RAW_VERSION, BASE_VERSION, BETA_VERSION<br/>and continue workflow]

  Error --> End([Done])
  Output --> End
Loading

File-Level Changes

Change Details Files
Add a version status display step to the release workflow and compute the final release version including a no-bump option.
  • Extend workflow_dispatch input choices with a new "none" option and clarify the description
  • Add a shell step that shows current main and beta versions for the Unity package and PyPI server, derives the stripped beta version, and prints the projected release version based on the selected bump type
  • Update the version calculation logic so that when the bump type is "none" it reuses the current stripped version, and otherwise applies major/minor/patch arithmetic as before
.github/workflows/release.yml
Change beta workflow for the Unity package to bump patch and increment beta numbers instead of always bumping minor.
  • Replace generic pre-release stripping with regex-based detection of existing beta versions and increment the beta counter when already on a beta tag
  • When on a stable X.Y.Z version, bump the patch and append -beta.1, failing fast if the version does not match expected patterns
  • Preserve and expose flags/outputs indicating whether the version was already beta or newly converted
.github/workflows/beta-release.yml
Change beta workflow for the server (PyPI) package to bump patch instead of minor when generating beta versions.
  • Adjust comments and logic to bump the PATCH component and form a PEP 440 beta version using the incremented patch rather than minor
  • Keep timestamp-based beta number generation while ensuring the beta version is strictly newer than the base stable version
.github/workflows/beta-release.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 3, 2026

📝 Walkthrough

Walkthrough

Refactors CI version handling: beta-release now uses regex branches to increment or convert versions (including PyPI patch-bump), and release workflow adds a "none" bump option plus a step showing current/projected versions and conditional bumping.

Changes

Cohort / File(s) Summary
Beta release workflow
.github/workflows/beta-release.yml
Rewrote version parsing to regex-driven branches: detect -beta.N to increment, convert stable X.Y.Z → X.Y.(Z+1)-beta.1, add error path for unparsable versions; changed PyPI prerelease to patch-bump for beta generation; updated log messages.
Release workflow
.github/workflows/release.yml
Added version_bump choice none; new "Show current versions" step prints main/beta versions and projected release; compute step now preserves current version when bump is none, otherwise applies semantic bump.
Editor UI
MCPForUnity/Editor/Windows/MCPForUnityEditorWindow.cs
Changed version label to always render as v{version} (removed conditional beta marker from label text); tooltip logic unchanged.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰
I hopped through YAML, stitched versions neat,
Beta tails lengthened, stable patches meet,
A regex nibble, a bump so spry,
"None" held still beneath the sky,
I nibble tags and let releases fly ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: beta workflow now bumps patch instead of minor for beta versions.
Description check ✅ Passed The pull request description covers all required template sections with comprehensive detail on changes, problem statement, solution, examples, and test plan.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • In the Show current versions step, the none option reports Release version will be: $STRIPPED, but the later bump logic sets NEW_VERSION to CURRENT_VERSION; double-check that CURRENT_VERSION is guaranteed to match the stripped beta value to avoid discrepancies between what’s shown and what’s actually released.
  • The version parsing/formatting logic (regexes, IFS='.' read -r, increment rules) is now duplicated in multiple steps across release.yml and beta-release.yml; consider extracting a shared script or centralizing the logic to reduce the risk of future divergence.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In the `Show current versions` step, the `none` option reports `Release version will be: $STRIPPED`, but the later bump logic sets `NEW_VERSION` to `CURRENT_VERSION`; double-check that `CURRENT_VERSION` is guaranteed to match the stripped beta value to avoid discrepancies between what’s shown and what’s actually released.
- The version parsing/formatting logic (regexes, `IFS='.' read -r`, increment rules) is now duplicated in multiple steps across `release.yml` and `beta-release.yml`; consider extracting a shared script or centralizing the logic to reduce the risk of future divergence.

## Individual Comments

### Comment 1
<location> `.github/workflows/beta-release.yml:165-166` </location>
<code_context>
           IFS='.' read -r MAJOR MINOR PATCH <<< "$BASE_VERSION"
-          NEXT_MINOR=$((MINOR + 1))
+          NEXT_PATCH=$((PATCH + 1))
           BETA_NUMBER="$(date +%Y%m%d%H%M%S)"
-          BETA_VERSION="${MAJOR}.${NEXT_MINOR}.0b${BETA_NUMBER}"
+          BETA_VERSION="${MAJOR}.${MINOR}.${NEXT_PATCH}b${BETA_NUMBER}"
           echo "Raw version: $RAW_VERSION"
           echo "Base version: $BASE_VERSION"
</code_context>

<issue_to_address>
**suggestion (bug_risk):** Timestamp-based beta suffix may be overlong and cannot be parsed by the existing strip logic in this workflow.

The `bYYYYMMDDHHMMSS` suffix won’t be removed by the existing strip logic (`sed -E 's/-[a-zA-Z]+\.[0-9]+$//'`), which only handles dash-plus-label forms like `-beta.1`. If this workflow runs on a beta PyPI version, `BASE_VERSION` will fail regex validation because the `b...` suffix remains. Consider either updating the strip pattern to handle PEP 440 `bN`-style suffixes or switching this beta marker to a simpler `bN` scheme so the workflow stays consistent and robust.

Suggested implementation:

```
          BASE_VERSION="$(echo "$RAW_VERSION" | sed -E 's/-[a-zA-Z]+\.[0-9]+$//; s/b[0-9]+$//')"

```

```
          # Bump patch and add beta suffix (PEP 440 compliant: X.Y.Z+1bN)
          # This ensures beta is "newer" than stable (9.3.2b1 > 9.3.1)
          # The release workflow decides final bump type (patch/minor/major)
          # NOTE: strip logic above removes both "-label.N" and "bN"/"b<timestamp>" suffixes
          IFS='.' read -r MAJOR MINOR PATCH <<< "$BASE_VERSION"
          NEXT_PATCH=$((PATCH + 1))
          BETA_NUMBER="$(date +%Y%m%d%H%M%S)"
          BETA_VERSION="${MAJOR}.${MINOR}.${NEXT_PATCH}b${BETA_NUMBER}"

```

I assumed the line that derives BASE_VERSION currently uses:
  sed -E 's/-[a-zA-Z]+\.[0-9]+$//'
If the actual command differs, update that occurrence to also include `s/b[0-9]+$//` so that any PEP 440 `bN`-style suffix (including timestamp-based `bYYYYMMDDHHMMSS`) is stripped before regex validation. No other changes to the beta version generation logic are required.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

The version string now includes "-beta.N" suffix, making the
separate β indicator redundant.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In @.github/workflows/beta-release.yml:
- Around line 160-166: The current logic always increments PATCH from
BASE_VERSION causing patch bumps when BASE_VERSION is already a beta; change the
logic in the block that computes MAJOR, MINOR, PATCH, NEXT_PATCH and
BETA_VERSION to detect pre-release/beta suffixes in BASE_VERSION (e.g., match
/b[0-9]+/ or any pre-release separator) and, if a beta is present, parse
MAJOR.MINOR.PATCH from the base without incrementing PATCH (set
NEXT_PATCH=PATCH), otherwise keep the existing behavior of
NEXT_PATCH=$((PATCH+1)); then continue to compute BETA_NUMBER and BETA_VERSION
as before using NEXT_PATCH so existing-beta runs only update the beta suffix
while stable runs bump the patch.
- Around line 43-67: The code treats an existing beta (when CURRENT_VERSION
matches the beta regex) as "already_beta=true", which prevents persisting an
incremented BETA_VERSION; change the branch that handles the beta regex (the
block that calculates BASE_VERSION, BETA_NUM, NEXT_BETA, BETA_VERSION and
currently sets already_beta=true) so that after computing BETA_VERSION you
compare it to CURRENT_VERSION and, if they differ, emit unity_beta_version to
GITHUB_OUTPUT and set already_beta=false (or set a separate needs_update flag
that downstream steps check) so the workflow will perform the update/commit
steps when the computed beta actually changed; keep writing unity_beta_version
to GITHUB_OUTPUT in either case to preserve downstream behavior.

beta-release.yml:
- Changed from already_beta to needs_update flag
- Only skip updates when computed version matches current
- PyPI versioning now detects existing prereleases and keeps
  the same base version instead of always bumping patch

release.yml:
- Preview step outputs stripped_version to GITHUB_OUTPUT
- Compute step uses previewed value for "none" bump option
- Added sanity check warning if versions diverge unexpectedly

This ensures the released version matches what was shown to the
user and prevents unnecessary patch bumps on consecutive beta runs.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@dsarno dsarno merged commit 7aa539c into CoplayDev:beta Feb 3, 2026
2 checks passed
msanatan pushed a commit to msanatan/unity-mcp that referenced this pull request Feb 9, 2026
* fix: beta workflow no longer auto-bumps minor version

Changes to beta-release.yml:
- Beta now bumps patch instead of minor (9.3.1 → 9.3.2-beta.1)
- Allows patch releases without being forced into minor bumps
- Increment beta number if already a beta version

Changes to release.yml:
- Added "none" bump option to release beta version as-is
- Added version status display showing main/beta versions and
  what the release version will be

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* chore: remove redundant β character from version badge

The version string now includes "-beta.N" suffix, making the
separate β indicator redundant.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: improve version consistency in release workflows

beta-release.yml:
- Changed from already_beta to needs_update flag
- Only skip updates when computed version matches current
- PyPI versioning now detects existing prereleases and keeps
  the same base version instead of always bumping patch

release.yml:
- Preview step outputs stripped_version to GITHUB_OUTPUT
- Compute step uses previewed value for "none" bump option
- Added sanity check warning if versions diverge unexpectedly

This ensures the released version matches what was shown to the
user and prevents unnecessary patch bumps on consecutive beta runs.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
@dsarno dsarno deleted the fix/beta-release-versioning branch February 13, 2026 04:28
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.

1 participant