Skip to content

chore: improve reliability of version bumping scripts - #1086

Open
avasconcelos114 wants to merge 1 commit into
masterfrom
cursor/improve-version-bump-scripts
Open

avasconcelos114 wants to merge 1 commit into
masterfrom
cursor/improve-version-bump-scripts

Conversation

@avasconcelos114

@avasconcelos114 avasconcelos114 commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Ports the version bump setup from mattermost/mattermost-plugin-gitlab#745 (itself a port of mattermost-plugin-starter-template#262).

  • Adds build/next-version.sh, which computes the next semver tag from tags reachable from HEAD, so release branches bump their own line.
  • Consolidates patch/minor/major and -rc targets in the Makefile into one bump_version macro that fetches tags first.
  • Adds DRY_RUN=1 to print the computed version without tagging or pushing, and deletes the local tag if the push fails.
  • Adds build/next-version_test.sh.

Testing: bash build/next-version_test.sh passes. No tags were created or pushed.

Open in Web Open in Cursor 

Change Impact: Medium 🟡

Changes Breakdown:

+98 -87 Production Changes (56.4%)
+143 -0 Test Changes (43.6%)

Regression Risk: The Makefile release targets now route every bump kind through the new build/next-version.sh, so a defect can produce wrong or duplicate tags on the remote. The added test harness covers version computation, but the tagging, signing, and push paths are not covered by tests.

Generated by CodeRabbitAI

Port mattermost-plugin-starter-template#262 (as done in mattermost-plugin-gitlab#745): compute next version in build/next-version.sh, add DRY_RUN support and tests.

Co-authored-by: Andre Vasconcelos <andre.onogoro@gmail.com>
@avasconcelos114
avasconcelos114 marked this pull request as ready for review November 13, 2026 13:54
@avasconcelos114
avasconcelos114 requested a review from a team as a code owner November 13, 2026 13:54
@coderabbitai

coderabbitai Bot commented Nov 13, 2026

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The release targets now use a shared version-selection script and tagging flow. The script selects release and RC versions from Git tags, validates inputs and refs, and rejects existing tags. A Bash test harness checks version selection across tagged histories and invalid inputs.

Changes: Release versioning and tagging

Layer / File(s) Summary
Version selection and validation
build/next-version.sh, build/next-version_test.sh
The script calculates release and RC versions from Git tags and rejects unsupported bump kinds, invalid refs, and existing generated tags. The test harness checks outputs and errors across tagged histories, including histories without valid SemVer tags.
Shared release tagging flow
Makefile
The six release targets use a shared function to calculate versions. It checks branch and upstream conditions, supports a print-only DRY_RUN path, prompts for approval, creates a signed annotated tag, and removes the local tag if pushing fails.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Makefile
  participant bump_version
  participant next_version as build/next-version.sh
  participant approver
  participant local_git as local Git repository
  participant origin
  Makefile->>bump_version: Call with bump kind and display label
  bump_version->>origin: Fetch tags and check upstream branch
  bump_version->>next_version: Request computed version
  next_version-->>bump_version: Return version tag
  alt DRY_RUN is set
    bump_version-->>Makefile: Print version and exit
  else DRY_RUN is empty
    bump_version->>approver: Request approval
    approver-->>bump_version: Return approval
    bump_version->>local_git: Create signed annotated tag
    bump_version->>origin: Push tag
    opt Push fails
      bump_version->>local_git: Delete local tag
    end
  end
Loading
Merge Risk: Minimal · up to c5777

The change makes the release version-bump targets compute the next version from tags reachable from the current branch. It also adds a dry-run mode and cleans up the local tag if a push fails. No concrete merge-blocking risk was identified. Test execution and live release-flow behavior were not independently verified in this review.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main theme of the changeset: version-bumping scripts were reworked for reliability. The changeset adds build/next-version.sh, consolidates the release Makefile targets around it, a…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main theme of the changeset: version-bumping scripts were reworked for reliability. The changeset adds build/next-version.sh, consolidates the release Makefile targets around it, and adds a test harness. The title is accurate and specific enough, although the word "reliability" is broad and the title does not mention the new tag-computation logic or the DRY_RUN mode. The conventional-commit prefix "chore:" fits the change.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 732113e1-b839-49be-9369-61af23e5fdce
Commits

Reviewing files that changed from the base of the PR and between bcbfe13 and c577791.

Files selected for processing: 3

  • Makefile
  • build/next-version.sh
  • build/next-version_test.sh

Included review availability: This review used your included allowance. 1 included review remains after this review. Your included PR review attempts over the past 7 days set your current allowance at 4 reviews per hour.

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