@@ -172,16 +172,12 @@ jobs:
172172
173173 echo "DEBUG: BASE_VERSION: $BASE_VERSION, COMMIT_HASH: $COMMIT_HASH"
174174
175- # 生成 semver 版本號,使用 run_number 確保遞增且符合 MSI 限制
176- # run_number 是 GitHub Actions 的內建變數,每次執行會遞增
175+ # 生成簡化的 semver 版本號,符合 MSI 限制
176+ # 格式: 0.5.9-123 (只用 run_number,確保能被正式版 0.5.9 更新)
177177 RUN_NUMBER=${{ github.run_number }}
178- if [ -n "$COMMIT_HASH" ]; then
179- SHORT_SHA=$(echo "$COMMIT_HASH" | cut -c1-7)
180- # 格式: 0.5.9-staging.123 (run_number) 或 0.5.9-staging.123.abc1234 (帶 commit)
181- STAGING_VERSION="${BASE_VERSION}-staging.${RUN_NUMBER}.${SHORT_SHA}"
182- else
183- STAGING_VERSION="${BASE_VERSION}-staging.${RUN_NUMBER}"
184- fi
178+ STAGING_VERSION="${BASE_VERSION}-${RUN_NUMBER}"
179+
180+ echo "DEBUG: Generated staging version: $STAGING_VERSION"
185181
186182 # 更新 Cargo.toml 版本號
187183 sed -i '' "s/^version = .*/version = \"$STAGING_VERSION\"/" src-tauri/Cargo.toml
@@ -407,16 +403,12 @@ jobs:
407403
408404 Write-Host "DEBUG: BASE_VERSION: $BASE_VERSION, COMMIT_PART: $COMMIT_PART"
409405
410- # 生成 semver 版本號,使用 run_number 確保遞增且符合 MSI 限制
411- # run_number 是 GitHub Actions 的內建變數,每次執行會遞增
406+ # 生成簡化的 semver 版本號,符合 MSI 限制
407+ # 格式: 0.5.9-123 (只用 run_number,確保能被正式版 0.5.9 更新)
412408 $RUN_NUMBER = "${{ github.run_number }}"
413- if ($COMMIT_PART) {
414- $SHORT_SHA = $COMMIT_PART.Substring(0, [Math]::Min(7, $COMMIT_PART.Length))
415- # 格式: 0.5.9-staging.123 (run_number) 或 0.5.9-staging.123.abc1234 (帶 commit)
416- $STAGING_VERSION = "$BASE_VERSION-staging.$RUN_NUMBER.$SHORT_SHA"
417- } else {
418- $STAGING_VERSION = "$BASE_VERSION-staging.$RUN_NUMBER"
419- }
409+ $STAGING_VERSION = "$BASE_VERSION-$RUN_NUMBER"
410+
411+ Write-Host "DEBUG: Generated staging version: $STAGING_VERSION"
420412
421413 # 更新 Cargo.toml 版本號(只更新 package version,不影響 rust-version)
422414 $cargoContent = Get-Content "src-tauri\Cargo.toml" -Raw
@@ -708,15 +700,10 @@ jobs:
708700 # Extract commit hash (everything after the first dash following base version)
709701 COMMIT_HASH=$(echo "$DISPLAY_VERSION" | sed 's/^staging-[0-9.]*//' | sed 's/^-//')
710702
711- # Create semver compatible version with run_number for proper version ordering
712- # Format: 0.5.9-staging. 123.sha (ensures newer builds always have higher version )
703+ # Create simplified semver version for staging
704+ # Format: 0.5.9-123 (ensures proper update from staging to release )
713705 RUN_NUMBER=${{ github.run_number }}
714- if [ -n "$COMMIT_HASH" ]; then
715- SHORT_SHA=$(echo "$COMMIT_HASH" | cut -c1-7)
716- SEMVER_VERSION="${BASE_VERSION}-staging.${RUN_NUMBER}.${SHORT_SHA}"
717- else
718- SEMVER_VERSION="${BASE_VERSION}-staging.${RUN_NUMBER}"
719- fi
706+ SEMVER_VERSION="${BASE_VERSION}-${RUN_NUMBER}"
720707 else
721708 # For release versions, use as-is
722709 SEMVER_VERSION="${{ env.CR_DISPLAY_VERSION }}"
0 commit comments