Skip to content

[codex] Automate desktop release version sync#5

Merged
DragonnZhang merged 3 commits into
mainfrom
dragon/add-desktop-release-workflow
Jun 8, 2026
Merged

[codex] Automate desktop release version sync#5
DragonnZhang merged 3 commits into
mainfrom
dragon/add-desktop-release-workflow

Conversation

@DragonnZhang

@DragonnZhang DragonnZhang commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

What this PR does

Adds release-version tooling to the desktop release flow. The manual workflow asks for a desktop app version, accepts either 0.0.2 or v0.0.2, normalizes that into package version 0.0.2 and release tag v0.0.2, and uses the same version across installer builds, GitHub Release publishing, and the version-sync PR.

The workflow now bumps desktop package versions inside GitHub Actions. For dry_run=true, each build job bumps locally and builds installers without pushing a branch or touching GitHub Releases. For dry_run=false, the workflow requires main, creates release/desktop-vX.Y.Z, commits the bumped versions, builds from that release ref, publishes the Release against that ref, then creates a version-sync PR back to main and enables auto-merge.

This also adds bun run bump-desktop-version <version>, which updates the three desktop release version sources together: package.json, apps/electron/package.json, and packages/shared/package.json. Use --dry-run to preview the changes without writing files.

Why it's needed

The installer version comes from the Electron app package metadata, while the runtime-visible version comes from the shared package metadata. Without explicit tooling, a maintainer could type 0.0.2 in GitHub Actions while the packaged app still reports 0.0.1, or manually bump only one of the package files.

Keeping these versions aligned is also the base contract needed before electron auto-update metadata is enabled later. Automating the bump in the release workflow removes the need for a manual pre-release version PR.

Reviewer Test Plan

How to verify

Run bun run bump-desktop-version --dry-run 0.0.2 and confirm it lists package.json, apps/electron/package.json, and packages/shared/package.json changing from 0.0.1 to 0.0.2 while leaving the working tree unchanged.

Run the Desktop Release workflow from GitHub Actions with version=0.0.2 and dry_run=true from this branch; confirm the prepare job bumps and validates the version, the build jobs start from the selected ref and bump locally before packaging, the dry-run summary uses release tag v0.0.2, and no release branch or GitHub Release is created.

After this PR lands, run the workflow from main with dry_run=false. Confirm it creates release/desktop-vX.Y.Z, publishes the GitHub Release against that release ref, creates chore(release): desktop vX.Y.Z, and enables auto-merge for that version-sync PR.

Evidence (Before & After)

N/A. This is CI/release automation, not a user-visible UI change.

Tested on

OS Status
🍏 macOS ✅ tested
🪟 Windows ⚠️ not tested
🐧 Linux ⚠️ not tested

Environment (optional)

Local checks on macOS:

  • bun run bump-desktop-version --dry-run 0.0.2
  • bun run bump-desktop-version --dry-run v0.0.2
  • bun run bump-desktop-version --dry-run 0.02 fails as expected because 0.02 is not valid SemVer
  • bun run bump-desktop-version 0.0.1
  • bun run check-release-version --version 0.0.1
  • bun run check-release-version --version 0.0.2 fails as expected while source versions are still 0.0.1
  • ruby -e 'require "yaml"; YAML.load_file(".github/workflows/desktop-release.yml"); puts "YAML OK"'
  • go run github.com/rhysd/actionlint/cmd/actionlint@latest .github/workflows/desktop-release.yml
  • git diff --check

Risk & Scope

  • Main risk or tradeoff: The first full installer build and auto-merge path still need to run on GitHub-hosted macOS, Windows, and Linux runners. Local validation proves workflow syntax, version checks, bump behavior, and shell structure.
  • Not validated / out of scope: Code signing, notarization, Windows signing, and electron auto-update feed behavior are intentionally not enabled here.
  • Breaking changes / migration notes: Maintainers no longer need a manual pre-release version bump PR. For real publishing, run the workflow from main with dry_run=false; the workflow will create and auto-merge the version-sync PR.

Linked Issues

N/A

中文说明

What this PR does

给桌面端发布流程增加 release version 工具。手动 workflow 填写的是桌面端 app version,支持输入 0.0.2v0.0.2,会统一转换成 package version 0.0.2 和 release tag v0.0.2,并且让安装包构建、GitHub Release 发布、版本同步 PR 都使用同一个版本。

workflow 现在会在 GitHub Actions 里自动 bump 桌面端 package 版本。dry_run=true 时,每个 build job 都只在本地 bump 后打安装包,不推分支,也不碰 GitHub Releases。dry_run=false 时,workflow 要求从 main 触发,创建 release/desktop-vX.Y.Z,提交 bump 后的版本,从这个 release ref 构建,基于这个 ref 发布 Release,然后自动创建同步回 main 的版本 PR 并开启 auto-merge。

同时新增 bun run bump-desktop-version <version>,一次性更新三个桌面端发布版本源:package.jsonapps/electron/package.jsonpackages/shared/package.json。可以用 --dry-run 预览改动,不写文件。

Why it's needed

安装包版本来自 Electron app package metadata,运行时可见版本来自 shared package metadata。如果没有显式工具,维护者可能在 GitHub Actions 里填了 0.0.2,但最终打出来的 app 仍然显示 0.0.1,或者手动 bump 时只改了其中一个 package 文件。

保持这些版本一致,也是后续启用 electron 自动更新 metadata 前必须有的基础约定。把 bump 放进 release workflow 后,就不再需要发版前人工提一个版本号 PR。

Reviewer Test Plan

How to verify

运行 bun run bump-desktop-version --dry-run 0.0.2,确认它会列出 package.jsonapps/electron/package.jsonpackages/shared/package.json0.0.1 改到 0.0.2,但不会改动工作区。

在 GitHub Actions 里从这个分支运行 Desktop Release workflow,设置 version=0.0.2dry_run=true;确认 prepare job 会 bump 并校验版本,build jobs 会从所选 ref 开始并在本地 bump 后再打包,dry-run summary 使用 release tag v0.0.2,并且不会创建 release branch 或 GitHub Release。

这个 PR 合并后,从 main 运行 workflow,并设置 dry_run=false。确认它会创建 release/desktop-vX.Y.Z,基于这个 release ref 发布 GitHub Release,创建 chore(release): desktop vX.Y.Z,并为这个版本同步 PR 开启 auto-merge。

Evidence (Before & After)

N/A。这是 CI/release 自动化,不是用户可见 UI 改动。

Tested on

OS Status
🍏 macOS ✅ tested
🪟 Windows ⚠️ not tested
🐧 Linux ⚠️ not tested

Environment (optional)

macOS 本地检查:

  • bun run bump-desktop-version --dry-run 0.0.2
  • bun run bump-desktop-version --dry-run v0.0.2
  • bun run bump-desktop-version --dry-run 0.02 按预期失败,因为 0.02 不是合法 SemVer
  • bun run bump-desktop-version 0.0.1
  • bun run check-release-version --version 0.0.1
  • bun run check-release-version --version 0.0.2 在源码仍是 0.0.1 时按预期失败
  • ruby -e 'require "yaml"; YAML.load_file(".github/workflows/desktop-release.yml"); puts "YAML OK"'
  • go run github.com/rhysd/actionlint/cmd/actionlint@latest .github/workflows/desktop-release.yml
  • git diff --check

Risk & Scope

  • Main risk or tradeoff: 第一次完整安装包构建和 auto-merge 路径仍然需要在 GitHub 托管的 macOS、Windows、Linux runner 上执行;本地校验证明的是 workflow 语法、版本校验、bump 行为和 shell 结构正确。
  • Not validated / out of scope: 这里不启用代码签名、公证、Windows 签名,也不处理 electron 自动更新 feed。
  • Breaking changes / migration notes: 维护者不再需要发版前手动提版本号 PR。真正发布时,从 main 运行 workflow,并设置 dry_run=false;workflow 会自动创建并 auto-merge 版本同步 PR。

Linked Issues

N/A

@DragonnZhang DragonnZhang changed the title [codex] Validate desktop release version [codex] Automate desktop release version sync Jun 8, 2026
@DragonnZhang DragonnZhang merged commit a2edc0b into main Jun 8, 2026
1 check passed
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