fix(release): 桌面版版本号跟 git tag 自动联动

之前 electron-builder 从 package.json 取版本号(写死 2.1.4),
导致 dmg/exe 文件名与 git tag(v2.1.5)脱节。

- 两个 electron build job 在构建前用 tag 号同步 package.json
  (npm version --no-git-tag-version),文件名自动跟 tag 走
- bump package.json 到 2.1.5 保持本地一致

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
hfshfg
2026-06-17 17:27:00 +08:00
parent f715aef9c9
commit df96be9af9
2 changed files with 18 additions and 1 deletions

View File

@@ -182,6 +182,15 @@ jobs:
cd u-claw-app cd u-claw-app
npm install --registry=https://registry.npmmirror.com npm install --registry=https://registry.npmmirror.com
- name: Sync version from tag
shell: bash
run: |
tag_name="${GITHUB_REF_NAME:-${{ github.event.inputs.tag }}}"
ver="${tag_name#v}" # strip leading v -> 2.1.5
cd u-claw-app
npm version "$ver" --no-git-tag-version --allow-same-version
echo "桌面版版本号已同步为 $ver"
- name: Build Windows installer - name: Build Windows installer
shell: cmd shell: cmd
run: | run: |
@@ -213,6 +222,14 @@ jobs:
cd u-claw-app cd u-claw-app
npm install --registry=https://registry.npmmirror.com npm install --registry=https://registry.npmmirror.com
- name: Sync version from tag
run: |
tag_name="${GITHUB_REF_NAME:-${{ github.event.inputs.tag }}}"
ver="${tag_name#v}" # strip leading v -> 2.1.5
cd u-claw-app
npm version "$ver" --no-git-tag-version --allow-same-version
echo "桌面版版本号已同步为 $ver"
- name: Build macOS DMG - name: Build macOS DMG
run: | run: |
cd u-claw-app cd u-claw-app

View File

@@ -1,6 +1,6 @@
{ {
"name": "u-claw", "name": "u-claw",
"version": "2.1.4", "version": "2.1.5",
"description": "U-Claw - AI 助手桌面版,插上 U 盘就能用", "description": "U-Claw - AI 助手桌面版,插上 U 盘就能用",
"main": "src/main.js", "main": "src/main.js",
"author": "U-Claw <hello@u-claw.org> (https://u-claw.org)", "author": "U-Claw <hello@u-claw.org> (https://u-claw.org)",