Skip to content

fix: release workflow — prevent double build number and fix changelog#524

Merged
grunch merged 1 commit into
mainfrom
fix/release-workflow-complete
Mar 9, 2026
Merged

fix: release workflow — prevent double build number and fix changelog#524
grunch merged 1 commit into
mainfrom
fix/release-workflow-complete

Conversation

@mostronatorcoder

@mostronatorcoder mostronatorcoder Bot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

Problems Fixed

1. 🚨 Double build number (1.2.1+936+943)

Root cause: Tag v1.2.1+936 (created by old desktop.yml) was not deleted before pushing v1.2.1. Both tags triggered release.yml simultaneously. The v1.2.1+936 run extracted TAG=1.2.1+936 and the sed produced 1.2.1+936+BUILD.

Fix: Tag pattern now only matches clean semver: v[0-9]+.[0-9]+.[0-9]+ (not v1.2.3+456). Additionally, version extraction strips any + metadata defensively.

2. Empty CHANGELOG sections

Root cause: CHANGELOG was generated during the tag checkout phase. Then git checkout main overwrote it.

Fix: CHANGELOG is now generated AFTER git checkout main and merge, using the same categorized data from RELEASE_NOTES.md.

3. Previous tag picking up build-metadata tags

Fix: PREV_TAG filter now only considers clean semver tags (^v[0-9]+\.[0-9]+\.[0-9]+$).

4. Corrupted pubspec.yaml

Reverted 1.2.1+936+9431.2.0+2.

After merging

  1. Delete tag v1.2.1: git push origin --delete v1.2.1
  2. Delete the existing v1.2.1 release from GitHub
  3. Recreate: git tag -a v1.2.1 -m "v1.2.1" && git push origin v1.2.1
  4. One workflow runs → APK + changelog + release + desktop trigger ✅

Summary by CodeRabbit

  • Chores
    • Updated release automation to enforce strict semantic versioning for more precise tag matching and version extraction
    • Improved changelog and release notes generation with enhanced categorization and documentation visibility
    • Refined version management system to ensure clean, consistent version strings without metadata in builds

… generation

Problems fixed:
1. Tag pattern now only matches semver (v1.2.3), NOT v1.2.3+456
   - Prevents phantom workflow runs from build-metadata tags
2. Version extraction strips any build metadata from tag
   - TAG=v1.2.1+936 → version=1.2.1 (defensive, belt-and-suspenders)
3. CHANGELOG.md generated on main after checkout (not on tag)
   - Previous version generated CHANGELOG on tag checkout, then
     git checkout main overwrote it
4. Previous tag filter only considers clean semver tags
   - Prevents v1.2.1+936 from being picked as prev_tag
5. Exclude chore: update changelog commits from changelog
6. Revert corrupted pubspec.yaml (1.2.1+936+943 → 1.2.0+2)

Root cause of the corruption:
- Tag v1.2.1+936 (created by old desktop.yml) was not deleted
- When v1.2.1 was pushed, both tags triggered release.yml
- v1.2.1+936 run set VERSION=1.2.1+936, producing 1.2.1+936+BUILD
- This was pushed to main, corrupting pubspec.yaml
@grunch

grunch commented Mar 9, 2026

Copy link
Copy Markdown
Member

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

The release workflow was refactored to enforce strict semantic version tag matching (vX.Y.Z), improved version extraction by stripping build metadata, and restored CHANGELOG.md generation on the main branch by parsing RELEASE_NOTES.md into categorized sections.

Changes

Cohort / File(s) Summary
Release Workflow
.github/workflows/release.yml
Tag matching tightened to semantic versioning pattern. Version extraction logic enhanced with cleaner tag derivation (stripping v prefix and build metadata). RELEASE_NOTES.md output visibility improved with echo markers. CHANGELOG.md generation restored on main branch by parsing RELEASE_NOTES.md into categorized sections (Added, Fixed, Documentation, Changed) and appending to existing content.
Version Configuration
pubspec.yaml
Version string updated from 1.2.1+936+943 to 1.2.0+2, simplifying build metadata.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

Poem

🐰 A rabbit hops through git tags so fine,
With semver patterns in perfect line,
Changelogs bloom from release notes bright,
Building clean versions—no metadata blight! 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: fixing the release workflow to prevent double build numbers and fix changelog generation issues.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/release-workflow-complete

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
.github/workflows/release.yml (1)

207-211: Fragile header-skip assumption could duplicate or lose content.

tail -n +7 assumes the existing CHANGELOG.md has exactly 6 header lines. If the header format varies (e.g., different number of blank lines, additional metadata), this could either duplicate header content or skip actual changelog entries.

Consider a more robust approach that finds the first version entry dynamically:

♻️ Proposed fix using pattern-based skip
-            # Append previous changelog content (skip the header block — first 6 lines)
-            if [ -f CHANGELOG.md ]; then
-              tail -n +7 CHANGELOG.md
-            fi
+            # Append previous changelog content (skip header, start from first version entry)
+            if [ -f CHANGELOG.md ]; then
+              # Find line number of first "## [" (version entry) and print from there
+              FIRST_VERSION_LINE=$(grep -n '^## \[' CHANGELOG.md | head -1 | cut -d: -f1)
+              if [ -n "$FIRST_VERSION_LINE" ]; then
+                tail -n +"$FIRST_VERSION_LINE" CHANGELOG.md
+              fi
+            fi
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release.yml around lines 207 - 211, The current use of
"tail -n +7 CHANGELOG.md" is fragile; update the block that writes to
CHANGELOG_NEW.md to dynamically find the first version heading instead of
assuming 6 header lines — detect the first changelog entry by matching a version
heading pattern (e.g., a line matching '^## \[' or '^#\s*[0-9]\+' / '^##\s*\\[')
and print the file starting from that matched line; replace the "tail -n +7
CHANGELOG.md" invocation with a pattern-based command (awk/sed/grep) that
searches CHANGELOG.md for the first version header and outputs from there into
CHANGELOG_NEW.md so headers are neither duplicated nor accidentally skipped.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/workflows/release.yml:
- Around line 207-211: The current use of "tail -n +7 CHANGELOG.md" is fragile;
update the block that writes to CHANGELOG_NEW.md to dynamically find the first
version heading instead of assuming 6 header lines — detect the first changelog
entry by matching a version heading pattern (e.g., a line matching '^## \[' or
'^#\s*[0-9]\+' / '^##\s*\\[') and print the file starting from that matched
line; replace the "tail -n +7 CHANGELOG.md" invocation with a pattern-based
command (awk/sed/grep) that searches CHANGELOG.md for the first version header
and outputs from there into CHANGELOG_NEW.md so headers are neither duplicated
nor accidentally skipped.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: bc0aec57-b761-4c0f-a78f-c18978477e60

📥 Commits

Reviewing files that changed from the base of the PR and between d55cf04 and 3047fbb.

📒 Files selected for processing (2)
  • .github/workflows/release.yml
  • pubspec.yaml

@grunch grunch merged commit 3d651e0 into main Mar 9, 2026
1 check passed
@grunch grunch deleted the fix/release-workflow-complete branch March 9, 2026 21:45
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