Skip to content

Commit ed156a6

Browse files
committed
fix: update script
1 parent be648a0 commit ed156a6

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

Installer/GhostDraw.Installer.wixproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="WixToolset.Sdk/4.0.5">
22
<PropertyGroup>
3-
$11.0.3</Version>
3+
<Version Condition="'$(Version)' == ''">1.0.3</Version>
44
<OutputName>GhostDrawSetup-$(Version)</OutputName>
55
<OutputType>Package</OutputType>
66
<Platform>x64</Platform>

Scripts/Update-Version.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,10 @@ function Update-WixVersion {
255255

256256
$content = Get-Content $FilePath -Raw
257257
# Match: <Version Condition="'$(Version)' == ''">X.Y.Z</Version>
258-
$pattern = "(<Version\s+Condition=`"'\`$\(Version\)'\s*==\s*''`">)([^<]*)(</Version>)"
258+
$pattern = '<Version\s+Condition="''\$\(Version\)''\s*==\s*''''">([^<]*)</Version>'
259259

260260
if ($content -match $pattern) {
261-
$currentVersion = [regex]::Match($content, $pattern).Groups[2].Value
261+
$currentVersion = [regex]::Match($content, $pattern).Groups[1].Value
262262

263263
if ($currentVersion -eq $NewVersion) {
264264
Write-Host " Already at version $NewVersion" -ForegroundColor Gray
@@ -268,7 +268,8 @@ function Update-WixVersion {
268268
if ($DryRun) {
269269
Write-Host " [DRY-RUN] Would update: $currentVersion -> $NewVersion" -ForegroundColor Cyan
270270
} else {
271-
$newContent = $content -replace $pattern, "`$1$NewVersion`$3"
271+
$replacement = "<Version Condition=`"'`$(Version)' == ''`">$NewVersion</Version>"
272+
$newContent = $content -replace $pattern, $replacement
272273
Set-Content $FilePath -Value $newContent -NoNewline
273274
Write-Host " Updated: $currentVersion -> $NewVersion" -ForegroundColor Green
274275
}

0 commit comments

Comments
 (0)