Skip to content

fix(ci): use client_payload.version in desktop workflow#559

Merged
grunch merged 3 commits into
mainfrom
fix/desktop-workflow-version
Apr 9, 2026
Merged

fix(ci): use client_payload.version in desktop workflow#559
grunch merged 3 commits into
mainfrom
fix/desktop-workflow-version

Conversation

@mostronatorcoder

@mostronatorcoder mostronatorcoder Bot commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Problem

When release.yml triggers the desktop build via repository_dispatch, it passes the correct version in client_payload.version. However, the desktop workflow was ignoring this and reading pubspec.yaml from main instead — which still had the previous version at the time the build ran (the changelog PR with the version bump hadn't been merged yet).

This caused desktop assets to be named with the wrong version and uploaded to the previous GitHub Release.

Confirmed on v1.2.3: desktop workflow read 1.2.2 from pubspec.yaml and attached assets to v1.2.2. The missing assets were manually recovered and uploaded.

Fix

Both the build-desktop and publish jobs now use client_payload.version when triggered via repository_dispatch. They fall back to reading pubspec.yaml for manual workflow_dispatch runs.

Testing

Desktop assets for v1.2.3 were manually recovered from artifacts and attached to the release. This fix prevents the issue on all future releases.

Summary by CodeRabbit

  • Chores
    • Centralized version extraction for build and release, ensuring artifact names and release tags consistently reflect the selected version.
    • Build/publish steps now depend on the centralized version step; workflows will fail if the version is missing or not a valid semver.
    • Removed redundant per-step version parsing for cleaner release artifacts.

…atch

When release.yml triggers the desktop build via repository_dispatch,
it passes the correct version in client_payload.version. The desktop
workflow was ignoring this and reading pubspec.yaml from main instead,
which had the previous version at build time — causing desktop assets
to be attached to the wrong GitHub Release.

Both build-desktop and publish jobs now prefer client_payload.version
when available, falling back to pubspec.yaml for manual workflow_dispatch.
@grunch

grunch commented Apr 2, 2026

Copy link
Copy Markdown
Member

@coderabbitai review

1 similar comment
@grunch

grunch commented Apr 9, 2026

Copy link
Copy Markdown
Member

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Apr 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 Apr 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: ec70f6b0-3610-4a26-acdd-83ad6b32d253

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

Centralized version extraction into a new setup-version job that prefers github.event.client_payload.version, falls back to parsing pubspec.yaml with +build metadata stripped, enforces non-empty semver X.Y.Z (fails on invalid), and propagates the cleaned version to build-desktop and publish.

Changes

Cohort / File(s) Summary
GitHub Actions Desktop Workflow
.github/workflows/desktop.yml
Added setup-version job to extract/validate a cleaned semver from client_payload.version or pubspec.yaml (strip +build); updated build-desktop and publish jobs to needs: setup-version and use ${{ needs.setup-version.outputs.version }}; removed duplicate per-job version parsing and adjusted artifact/release naming and quoting.

Sequence Diagram(s)

sequenceDiagram
    participant Repo as Repository Dispatch
    participant Actions as GitHub Actions
    participant Setup as setup-version job
    participant Build as build-desktop job
    participant Publish as publish job
    participant Releases as GitHub Releases / Artifacts

    Repo->>Actions: trigger repository_dispatch (may include client_payload.version)
    Actions->>Setup: run setup-version (read payload or pubspec.yaml)
    Setup-->>Actions: outputs.version (validated X.Y.Z)
    Actions->>Build: needs: setup-version, use outputs.version to name artifacts
    Build-->>Actions: upload artifacts
    Actions->>Publish: needs: [build-desktop, setup-version], use outputs.version for release tag
    Publish->>Releases: create release/tag and publish artifacts
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 Hopping in with payload bright,
I fetch the version, trim its flight.
From dispatch first, or pubspec next,
I clean the semver, fail on hex.
Artifacts named, the release is done — hooray! 🎉

🚥 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 directly and specifically describes the main change: using client_payload.version in the desktop workflow to fix the version mismatch issue.
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
  • Commit unit tests in branch fix/desktop-workflow-version

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

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

112-127: Consider centralizing version extraction to one source of truth.

The same extraction logic now exists in two jobs; moving it to a dedicated setup job output (or reusable workflow/composite action) will prevent future drift.

Also applies to: 192-199

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

In @.github/workflows/desktop.yml around lines 112 - 127, Centralize the version
extraction by moving the logic that computes version (reads PAYLOAD_VERSION,
falls back to parsing full_version from pubspec.yaml and stripping build
metadata into version) into a single setup job or reusable workflow/composite
action that exposes VERSION as a job output (and sets GITHUB_ENV/GITHUB_OUTPUT),
then have other jobs consume that output instead of duplicating the same
grep/cut/tr construct; update references to PAYLOAD_VERSION, full_version, and
version to use the new setup job/output so all callers share the same source of
truth.
🤖 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 112-127: Validate the extracted version before writing to
GITHUB_ENV/GITHUB_OUTPUT and before tagging/publishing: after computing
PAYLOAD_VERSION or deriving full_version and stripping build metadata into
version, ensure version is non-empty and matches a strict semantic version regex
(e.g., ^[0-9]+\.[0-9]+\.[0-9]+$ or a project-specific pattern); if validation
fails, echo an error and exit non-zero. Apply the same checks to the publish
fallback code path that reads/publishes the version so both locations (the
PAYLOAD_VERSION branch and the publish fallback) reject malformed or empty
versions instead of propagating them.

---

Nitpick comments:
In @.github/workflows/desktop.yml:
- Around line 112-127: Centralize the version extraction by moving the logic
that computes version (reads PAYLOAD_VERSION, falls back to parsing full_version
from pubspec.yaml and stripping build metadata into version) into a single setup
job or reusable workflow/composite action that exposes VERSION as a job output
(and sets GITHUB_ENV/GITHUB_OUTPUT), then have other jobs consume that output
instead of duplicating the same grep/cut/tr construct; update references to
PAYLOAD_VERSION, full_version, and version to use the new setup job/output so
all callers share the same source of truth.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 33a4ed0f-28d1-4b47-bd18-8aac72d57d2e

📥 Commits

Reviewing files that changed from the base of the PR and between fca09d4 and dba8005.

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

Comment thread .github/workflows/desktop.yml Outdated
Address CodeRabbit review findings:
- Add setup-version job that extracts AND validates version (non-empty + semver regex)
- build-desktop and publish now depend on setup-version instead of duplicating extraction
- build-desktop uses needs.setup-version.outputs.version (single source of truth)
- publish also consumes version from setup-version output
- Both PAYLOAD_VERSION and pubspec.yaml paths validated with same regex
- Exit non-zero with error message if version is empty or malformed
@mostronatorcoder

Copy link
Copy Markdown
Contributor Author

CodeRabbit feedback addressed in f78f802:

  • Version validation: centralized in a new setup-version job that validates the version is non-empty and matches ^[0-9]+\.[0-9]+\.[0-9]+$ before writing any outputs. Both build-desktop and publish now consume the validated version via needs.setup-version.outputs.version.
  • Centralization: version extraction logic is now in a single job; no more duplication between the build job and publish job.

@mostronatorcoder mostronatorcoder Bot left a comment

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.

Both CodeRabbit comments addressed. LGTM.

@grunch

grunch commented Apr 9, 2026

Copy link
Copy Markdown
Member

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Apr 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 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:
- Line 22: The outputs case mismatch: the job output is referenced as ${{
steps.version.outputs.VERSION }} but the step writes version=$version to
$GITHUB_OUTPUT (case-sensitive). Fix by making the output key consistent—either
change the job output reference to ${{ steps.version.outputs.version }} or
change the GITHUB_OUTPUT write to use VERSION=$version—so the 'version' output
from the setup-version step and the downstream reference use the same exact key
(match the symbol ${ { steps.version.outputs.VERSION } } or 'version=$version'
accordingly).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6df2197f-eea4-4235-9a3b-ef0495936255

📥 Commits

Reviewing files that changed from the base of the PR and between dba8005 and f78f802.

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

Comment thread .github/workflows/desktop.yml
@grunch grunch merged commit 2eded43 into main Apr 9, 2026
2 checks passed
@grunch grunch deleted the fix/desktop-workflow-version branch April 9, 2026 17:18
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