Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,17 @@ jobs:
APP_VERSION: ${{ steps.version.outputs.version }}
run: |
$version = $env:APP_VERSION
# 计算四段数字版本号 (X.X.X.X),供 VersionInfoVersion 使用
# 去掉预发布标识 (如 1.0.0-beta -> 1.0.0),按点分割并补齐到四段
$numericPart = ($version -split '[-+]')[0]
$parts = $numericPart -split '\.'
while ($parts.Count -lt 4) { $parts += '0' }
if ($parts.Count -gt 4) { $parts = $parts[0..3] }
$versionInfo = ($parts | ForEach-Object { if ([int]::TryParse($_, [ref]$null)) { [int]::Parse($_) } else { 0 } }) -join '.'
$issFile = "scripts\windows\MarketAssistant.iss"
$content = Get-Content $issFile -Raw
$content = $content -replace '#define MyAppVersion ".*?"', "#define MyAppVersion `"$version`""
$content = $content -replace '#define MyAppVersionInfo ".*?"', "#define MyAppVersionInfo `"$versionInfo`""
Set-Content $issFile -Value $content -NoNewline
& "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe" $issFile

Expand Down
7 changes: 5 additions & 2 deletions scripts/windows/MarketAssistant.iss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

#define MyAppName "Market Assistant"
#define MyAppVersion "1.0.0"
; VersionInfoVersion / VersionInfoProductVersion 要求严格四段数字格式 X.X.X.X
; MyAppVersion 可能为三段(1.0.0)或含预发布标识(1.0.0-beta),此处单独定义四段版本
#define MyAppVersionInfo "1.0.0.0"
#define MyAppPublisher "MarketAssistant Team"
#define MyAppURL "https://github.com/X2Agent/MarketAssistant"
#define MyAppExeName "MarketAssistant.exe"
Expand Down Expand Up @@ -34,12 +37,12 @@ ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64

; 版本信息
VersionInfoVersion={#MyAppVersion}
VersionInfoVersion={#MyAppVersionInfo}
VersionInfoCompany={#MyAppPublisher}
VersionInfoDescription={#MyAppName} Installer
VersionInfoCopyright=Copyright (C) 2026 {#MyAppPublisher}
VersionInfoProductName={#MyAppName}
VersionInfoProductVersion={#MyAppVersion}
VersionInfoProductVersion={#MyAppVersionInfo}

; UI 配置
UninstallDisplayIcon={app}\{#MyAppExeName}
Expand Down
10 changes: 9 additions & 1 deletion scripts/windows/build-installer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,18 @@ Write-Host ""
$issFile = "scripts\windows\MarketAssistant.iss"
if ($Version) {
Write-Host "📝 Updating version to $Version..." -ForegroundColor Yellow
# 计算四段数字版本号 (X.X.X.X),供 VersionInfoVersion 使用
# 去掉预发布标识 (如 1.0.0-beta -> 1.0.0),按点分割并补齐到四段
$numericPart = ($Version -split '[-+]')[0]
$parts = $numericPart -split '\.'
while ($parts.Count -lt 4) { $parts += '0' }
if ($parts.Count -gt 4) { $parts = $parts[0..3] }
$versionInfo = ($parts | ForEach-Object { if ([int]::TryParse($_, [ref]$null)) { [int]::Parse($_) } else { 0 } }) -join '.'
$issContent = Get-Content $issFile -Raw
$issContent = $issContent -replace '#define MyAppVersion ".*?"', "#define MyAppVersion `"$Version`""
$issContent = $issContent -replace '#define MyAppVersionInfo ".*?"', "#define MyAppVersionInfo `"$versionInfo`""
Set-Content $issFile -Value $issContent -NoNewline
Write-Host "✓ Version updated" -ForegroundColor Green
Write-Host "✓ Version updated (display: $Version, version info: $versionInfo)" -ForegroundColor Green
Write-Host ""
}

Expand Down
Loading