.2059806565729300:abd25200c78e13b5c371069c1916e8f8_69e3499ab13256d09ece8088.69e3a0ebb13256d09ece8264.69e3a0eb7afba9383018b937:Trae CN.T(2026/4/18 23:19:07)#1272
Conversation
重构版本号获取脚本,统一处理不同CI环境和本地环境的版本号获取 添加版本信息输出功能,便于调试和验证构建版本 修改相关脚本以使用新的版本号获取方式
重构版本管理脚本,引入 TAG_VERSION 和 DISPLAY_VERSION 概念 添加版本一致性检查确保所有构建产物使用相同版本号 更新所有相关构建脚本以使用新的版本管理方式
Greptile SummaryThis PR refactors version management across all build scripts by introducing a single-source-of-truth
Confidence Score: 4/5Not safe to merge as-is — the new consistency check will break every Tauri CI build due to the regex ordering bug. Two P1 findings in verify_version_consistency (zip and installer regex) will cause false version mismatch failures on every Tauri build, blocking release packaging in CI. The rest of the refactor is sound. scripts/package/package-all.sh (lines 69–74 and 99–104 in verify_version_consistency) Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[CI Workflow: Determine version] --> B[getversion.sh]
B --> C{Version source}
C -->|GITHUB_REF_NAME starts with v| D[Use CI tag]
C -->|TRAVIS_TAG or APPVEYOR tag| D
C -->|git describe exact match| D
C -->|fallback| E[latest_tag.dev-commit]
D --> F[TAG_VERSION = v0.14.0 / DISPLAY_VERSION = 0.14.0]
E --> F
F --> G[package-all.sh]
G --> H[build_zip: zip filename uses DISPLAY_VERSION]
G --> I[build_setup: installer uses DISPLAY_VERSION]
G --> J[verify_version_consistency]
J --> K{Tauri zip regex check}
K -->|non-tauri| L[OK: version extracted correctly]
K -->|tauri build| M[BUG: captures tauri not version]
F --> N[build_app_tauri.sh: Info.plist uses DISPLAY_VERSION]
F --> O[package-deb.sh: deb name uses DISPLAY_VERSION]
Reviews (1): Last reviewed commit: "refactor(version): 统一版本管理逻辑并添加版本一致性检查" | Re-trigger Greptile |
| if [[ "$zip_file" =~ activitywatch-([^-]+)- ]]; then | ||
| zip_version="${BASH_REMATCH[1]}" | ||
| log_info " Extracted version: $zip_version" | ||
| elif [[ "$zip_file" =~ activitywatch-tauri-([^-]+)- ]]; then | ||
| zip_version="${BASH_REMATCH[1]}" | ||
| log_info " Extracted version: $zip_version" | ||
| fi |
There was a problem hiding this comment.
Tauri zip version regex always captures "tauri", not the version
For a Tauri zip named activitywatch-tauri-0.14.0-linux-x86_64.zip, the first pattern activitywatch-([^-]+)- matches immediately and captures "tauri" as zip_version. The elif branch for tauri is therefore unreachable. The check then compares "tauri" != "0.14.0" and marks the consistency check as failed on every Tauri build. The tauri-specific regex must be tested first.
| if [[ "$zip_file" =~ activitywatch-([^-]+)- ]]; then | |
| zip_version="${BASH_REMATCH[1]}" | |
| log_info " Extracted version: $zip_version" | |
| elif [[ "$zip_file" =~ activitywatch-tauri-([^-]+)- ]]; then | |
| zip_version="${BASH_REMATCH[1]}" | |
| log_info " Extracted version: $zip_version" | |
| fi | |
| if [[ "$zip_file" =~ activitywatch-tauri-([^-]+)- ]]; then | |
| zip_version="${BASH_REMATCH[1]}" | |
| log_info " Extracted version: $zip_version" | |
| elif [[ "$zip_file" =~ activitywatch-([^-]+)- ]]; then | |
| zip_version="${BASH_REMATCH[1]}" | |
| log_info " Extracted version: $zip_version" | |
| fi |
| if [[ "$installer_file" =~ activitywatch-([^-]+)- ]]; then | ||
| installer_version="${BASH_REMATCH[1]}" | ||
| log_info " Extracted version: $installer_version" | ||
| elif [[ "$installer_file" =~ activitywatch-tauri-([^-]+)- ]]; then | ||
| installer_version="${BASH_REMATCH[1]}" | ||
| log_info " Extracted version: $installer_version" | ||
| fi |
There was a problem hiding this comment.
Same regex ordering bug in installer version extraction
Identical issue as the zip check above: activitywatch-([^-]+)- always matches a Tauri installer filename first and captures "tauri", so installer_version is set to "tauri" instead of the actual version number. The consistency check will spuriously fail for every Windows Tauri installer build.
| if [[ "$installer_file" =~ activitywatch-([^-]+)- ]]; then | |
| installer_version="${BASH_REMATCH[1]}" | |
| log_info " Extracted version: $installer_version" | |
| elif [[ "$installer_file" =~ activitywatch-tauri-([^-]+)- ]]; then | |
| installer_version="${BASH_REMATCH[1]}" | |
| log_info " Extracted version: $installer_version" | |
| fi | |
| if [[ "$installer_file" =~ activitywatch-tauri-([^-]+)- ]]; then | |
| installer_version="${BASH_REMATCH[1]}" | |
| log_info " Extracted version: $installer_version" | |
| elif [[ "$installer_file" =~ activitywatch-([^-]+)- ]]; then | |
| installer_version="${BASH_REMATCH[1]}" | |
| log_info " Extracted version: $installer_version" | |
| fi |
| TAG_VERSION=$(bash scripts/package/getversion.sh --tag) | ||
| DISPLAY_VERSION=$(bash scripts/package/getversion.sh --display) |
There was a problem hiding this comment.
getversion.sh is invoked twice, doubling git operations
getversion.sh --tag and getversion.sh --display each run git describe independently, which is redundant. Using --env mode (as done in the shell scripts) and eval would fetch version information in a single call and is already the pattern established elsewhere in this PR.
| TAG_VERSION=$(bash scripts/package/getversion.sh --tag) | |
| DISPLAY_VERSION=$(bash scripts/package/getversion.sh --display) | |
| eval "$(bash scripts/package/getversion.sh --env)" |
| TAG_VERSION=$(bash scripts/package/getversion.sh --tag) | ||
| DISPLAY_VERSION=$(bash scripts/package/getversion.sh --display) |
There was a problem hiding this comment.
Same double invocation as
build.yml
getversion.sh is called twice in this step as well. Using --env mode with eval matches the pattern in the shell scripts and avoids running git describe twice.
| TAG_VERSION=$(bash scripts/package/getversion.sh --tag) | |
| DISPLAY_VERSION=$(bash scripts/package/getversion.sh --display) | |
| eval "$(bash scripts/package/getversion.sh --env)" |
统一版本管理逻辑并添加版本一致性检查
重构版本管理脚本,引入 TAG_VERSION 和 DISPLAY_VERSION 概念
添加版本一致性检查确保所有构建产物使用相同版本号
更新所有相关构建脚本以使用新的版本管理方式