fix: strip build number from desktop release version#522
Conversation
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
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughThe GitHub Actions workflow's version extraction step now captures the raw version in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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.
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
📒 Files selected for processing (1)
.github/workflows/desktop.yml
| # 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 |
There was a problem hiding this comment.
🧩 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
replacesArtifactsenabled by default? Yes — its documented default istrue. [1] (Also defined withdefault: 'true'inaction.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 -60Repository: MostroP2P/mobile
Length of output: 1966
🏁 Script executed:
head -50 .github/workflows/desktop.ymlRepository: MostroP2P/mobile
Length of output: 1594
🏁 Script executed:
tail -50 .github/workflows/desktop.ymlRepository: 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: falseA 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.
There was a problem hiding this comment.
Good catch. Fixed in 3e83d12 — moved release publishing to a dedicated publish job that:
- Waits for all 3 matrix builds to complete
- Downloads all artifacts with
actions/download-artifact - Uploads everything at once to the release
Also set replacesArtifacts: false so it won't overwrite Android assets already uploaded by release.yml.
There was a problem hiding this comment.
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.
Problem
The desktop workflow (
desktop.yml) reads the version frompubspec.yamlincluding the build number (e.g.1.2.1+936) and uses it for the release tag and asset naming. This caused:release.ymlcreatesv1.2.1(with APKs), thendesktop.ymlcreatesv1.2.1+936(with desktop builds)v1.2.1, desktop assets underv1.2.1+936Expected: one release
v1.2.1with ALL assets (APKs + desktop).Fix
Strip the build number from the version before using it for tags and release naming:
This ensures
desktop.ymlcreates/updates the release with tagv1.2.1(matching whatrelease.ymlalready created), soncipollo/release-actionwithallowUpdates: trueadds the desktop assets to the existing release.Follow-up to #520
Summary by CodeRabbit