Skip to content

fix: strip build number from desktop release version#522

Merged
grunch merged 2 commits into
mainfrom
fix/desktop-release-version-520
Mar 9, 2026
Merged

fix: strip build number from desktop release version#522
grunch merged 2 commits into
mainfrom
fix/desktop-release-version-520

Conversation

@mostronatorcoder

@mostronatorcoder mostronatorcoder Bot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

Problem

The desktop workflow (desktop.yml) reads the version from pubspec.yaml including the build number (e.g. 1.2.1+936) and uses it for the release tag and asset naming. This caused:

  1. Two separate releasesrelease.yml creates v1.2.1 (with APKs), then desktop.yml creates v1.2.1+936 (with desktop builds)
  2. Inconsistent naming — Android assets are under v1.2.1, desktop assets under v1.2.1+936

Expected: one release v1.2.1 with ALL assets (APKs + desktop).

Fix

Strip the build number from the version before using it for tags and release naming:

# Before: version=1.2.1+936
# After:  version=1.2.1
version=${full_version%%+*}

This ensures desktop.yml creates/updates the release with tag v1.2.1 (matching what release.yml already created), so ncipollo/release-action with allowUpdates: true adds the desktop assets to the existing release.

Follow-up to #520

Summary by CodeRabbit

  • Chores
    • Improved desktop build workflow to better distinguish between full version and release version information during the build process, enhancing version metadata handling and build output clarity.

Desktop workflow used full version from pubspec.yaml (e.g. 1.2.1+936)
for tag and release naming, creating a separate release instead of adding
assets to the existing one created by release.yml.

Now strips the build number (1.2.1+936 → 1.2.1) so desktop assets get
uploaded to the same release as Android APKs.

Follow-up to #520
@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

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8b28334a-4858-447e-8047-be2482641f4b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

The GitHub Actions workflow's version extraction step now captures the raw version in full_version, validates its non-empty state, and derives a release version by removing build metadata after a plus sign (e.g., 1.2.1+936 becomes 1.2.1). Both versions are echoed for visibility while the release version is exposed as the VERSION environment output.

Changes

Cohort / File(s) Summary
Version Extraction Enhancement
.github/workflows/desktop.yml
Modified version extraction to store raw version in full_version, validate non-empty state, and derive release version by stripping build metadata (text after +). Added echo statements for Full version and Release version visibility.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Poem

🐰 A version so clean, stripped of its clutter,
The plus sign's debris cast down to the gutter,
Now full and release dance hand in hand,
In workflows refined across the DevOps land!

🚥 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 describes the main change: stripping build numbers from desktop release versions in the workflow file.
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/desktop-release-version-520

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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/desktop.yml:
- Around line 116-119: The workflow currently strips build metadata into a
single VERSION variable (version=${full_version%%+*}) causing every matrix job
(Linux/macOS/Windows) to publish to the same v${{
steps.extract_version.outputs.version }} release and race via
ncipollo/release-action; fix by moving release publishing out of the matrix into
a separate non-matrix job that runs after the matrix (consume each matrix job's
upload-artifact outputs) and calls ncipollo/release-action once, or as a minimal
mitigation set replacesArtifacts: false and/or allowUpdates: false in the
release-action invocation to prevent parallel artifact replacement; update the
workflow to reference the same VERSION/GITHUB_OUTPUT produced by extract_version
but perform publishing only from the single coordinating job.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2a386c41-9219-4c5a-bd02-733ac6bc06b2

📥 Commits

Reviewing files that changed from the base of the PR and between 27f69ec and 18bab4f.

📒 Files selected for processing (1)
  • .github/workflows/desktop.yml

Comment on lines +116 to 119
# Strip build number for tag/release naming (1.2.1+936 → 1.2.1)
version=${full_version%%+*}
echo "VERSION=$version" >> $GITHUB_ENV
echo "version=$version" >> $GITHUB_OUTPUT

@coderabbitai coderabbitai Bot Mar 9, 2026

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.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

ncipollo/release-action Marketplace docs: what do allowUpdatesandreplacesArtifactsdo, and isreplacesArtifacts enabled by default?

💡 Result:

  • allowUpdates: If set, the action will update an existing release (for the tag) instead of failing/only trying to create a new one. It “defaults to false” (i.e., not enabled unless you set it). [1]
  • replacesArtifacts: Controls whether existing release assets (“artifacts”) are replaced when uploading artifacts to a release. [1]
  • Is replacesArtifacts enabled by default? Yes — its documented default is true. [1] (Also defined with default: 'true' in action.yml.) [2]

Sources: GitHub Marketplace “Create Release” (ncipollo/release-action) docs [1]; ncipollo/release-action action.yml [2].


🏁 Script executed:

cat -n .github/workflows/desktop.yml | sed -n '100,160p'

Repository: MostroP2P/mobile

Length of output: 2731


🏁 Script executed:

head -100 .github/workflows/desktop.yml | tail -60

Repository: MostroP2P/mobile

Length of output: 1966


🏁 Script executed:

head -50 .github/workflows/desktop.yml

Repository: MostroP2P/mobile

Length of output: 1594


🏁 Script executed:

tail -50 .github/workflows/desktop.yml

Repository: MostroP2P/mobile

Length of output: 2180


Publishing each matrix leg to the same tag will cause race conditions and potential asset conflicts.

Once this strips 1.2.1+936 to 1.2.1, all three platforms (Linux/macOS/Windows) target the same v${{ steps.extract_version.outputs.version }} release. The downstream ncipollo/release-action step runs once per matrix leg with allowUpdates: true and replacesArtifacts: true, meaning concurrent jobs independently update the same release. Although each platform uploads a uniquely named artifact, the uncoordinated, parallel release updates create a race condition where artifact metadata or release state could be corrupted or inconsistent. Use a separate non-matrix release job that downloads all three upload-artifact outputs and publishes once, or at minimum set replacesArtifacts: false to prevent accidental asset replacement.

Possible minimal mitigation in the downstream release step
       - name: Create GitHub Release
         uses: ncipollo/release-action@v1
         with:
           artifacts: "./dist/mostro-desktop-${{ steps.extract_version.outputs.version }}-${{ matrix.artifact-name }}"
           tag: v${{ steps.extract_version.outputs.version }}
           allowUpdates: true
           omitBodyDuringUpdate: true
-          replacesArtifacts: true
+          replacesArtifacts: false
           draft: false
           prerelease: false

A dedicated publish job that downloads all three upload-artifact outputs and calls release-action once would be safer.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/desktop.yml around lines 116 - 119, The workflow currently
strips build metadata into a single VERSION variable
(version=${full_version%%+*}) causing every matrix job (Linux/macOS/Windows) to
publish to the same v${{ steps.extract_version.outputs.version }} release and
race via ncipollo/release-action; fix by moving release publishing out of the
matrix into a separate non-matrix job that runs after the matrix (consume each
matrix job's upload-artifact outputs) and calls ncipollo/release-action once, or
as a minimal mitigation set replacesArtifacts: false and/or allowUpdates: false
in the release-action invocation to prevent parallel artifact replacement;
update the workflow to reference the same VERSION/GITHUB_OUTPUT produced by
extract_version but perform publishing only from the single coordinating job.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch. Fixed in 3e83d12 — moved release publishing to a dedicated publish job that:

  1. Waits for all 3 matrix builds to complete
  2. Downloads all artifacts with actions/download-artifact
  3. Uploads everything at once to the release

Also set replacesArtifacts: false so it won't overwrite Android assets already uploaded by release.yml.

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.

Skipped: comment is from another GitHub bot.

Separate the release publishing from the matrix build jobs into a single
'publish' job that:
1. Waits for all 3 platform builds to complete
2. Downloads all artifacts
3. Uploads them all at once to the existing release

This prevents race conditions from 3 matrix jobs concurrently updating
the same release with allowUpdates+replacesArtifacts.

Also set replacesArtifacts: false to avoid overwriting existing Android
assets uploaded by release.yml.

@grunch grunch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@grunch grunch merged commit 7f75ae7 into main Mar 9, 2026
2 checks passed
@grunch grunch deleted the fix/desktop-release-version-520 branch March 9, 2026 19:27
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