fix: beta workflow no longer auto-bumps minor version#673
fix: beta workflow no longer auto-bumps minor version#673dsarno merged 3 commits intoCoplayDev:betafrom
Conversation
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>
Reviewer's GuideAdjusts 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 calculationflowchart 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
Flow diagram for release workflow version selection with none optionflowchart 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])
Flow diagram for PyPI beta version computation in beta-release workflowflowchart 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
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
📝 WalkthroughWalkthroughRefactors 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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- In the
Show current versionsstep, thenoneoption reportsRelease version will be: $STRIPPED, but the later bump logic setsNEW_VERSIONtoCURRENT_VERSION; double-check thatCURRENT_VERSIONis 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 acrossrelease.ymlandbeta-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>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>
There was a problem hiding this comment.
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>
* 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>
Summary
Problem
Previously,
beta-release.ymlauto-bumped the minor version when creating a beta (e.g.,9.3.1→9.4.0-beta.1). This forced every release to be at least a minor bump, making patch releases impossible.Solution
beta-release.yml
9.3.1→9.3.2-beta.19.3.2-beta.1→9.3.2-beta.2already_betatoneeds_updateflag - compares computed vs current version to determine if update needed9.3.2bXXX→9.3.3bXXXon consecutive runs)release.yml
nonebump option to release beta version as-is after stripping suffixstripped_versionto ensure consistencyUnity Editor
-beta.N)Version Flow Examples
9.3.1→ beta9.3.2-beta.19.3.2-beta.1→ next push9.3.2-beta.2none9.3.2patch9.3.3minor9.4.0Test plan
🤖 Generated with Claude Code