22 [string ]$version
33)
44
5- $version_underscored = $version -replace ' \.' , ' _'
6- $setup_link = " https://github.com/Ellendar/Z2Randomizer/releases/download/$version /Z2Randomizer_${version_underscored} .msi"
5+ $setup_link = " https://github.com/Ellendar/Z2Randomizer/releases/download/$version /Z2Randomizer-$version -Windows-Installer.msi"
76$pub_date = Get-Date - Format " dddd, dd MMMM yyyy"
87
9- # Update appcast.xml
108$file = " appcast.xml"
119$content = Get-Content $file
12-
13- $firstMatch = $content | Select-String - Pattern ' ^\s*<item>' | Select-Object - First 1
14- $index = $firstMatch.LineNumber - 1
15- $before = $content [0 .. ($index - 1 )]
16- $after = $content [$index .. ($content.Length - 1 )]
17-
1810if ($content -like " *<title>Version $version </title>*" ) {
19- Write-Host " Version $version already exists in appcast.xml - ending."
20- exit 0
21- }
22-
23- $app_cast_item = @"
11+ Write-Host " Version $version already exists in appcast.xml"
12+ } else {
13+ $firstMatch = $content | Select-String - Pattern ' ^\s*<item>' | Select-Object - First 1
14+ $index = $firstMatch.LineNumber - 1
15+ $before = $content [0 .. ($index - 1 )]
16+ $after = $content [$index .. ($content.Length - 1 )]
17+ $app_cast_item = @"
2418 <item>
2519 <title>Version $version </title>
2620 <description>
@@ -32,26 +26,32 @@ $app_cast_item = @"
3226 <enclosure url=""$setup_link "" sparkle:version=""$version "" />
3327 </item>
3428"@
35-
36- Set-Content $file ($before + $app_cast_item + $after )
29+ Set-Content $file ($before + $app_cast_item + $after )
30+ }
31+ git add $file
3732
3833$file = " Directory.Build.targets"
3934(Get-Content $file ) |
4035 ForEach-Object {
4136 $_ -replace ' <Version>.*?</Version>' , " <Version>$version </Version>"
4237 } | Set-Content $file
38+ git add $file
4339
4440$file = " README.md"
4541(Get-Content $file ) |
4642 ForEach-Object {
4743 $_ -replace ' \[Download\]\([^)]*\)' , " [Download]($setup_link )"
4844 } | Set-Content $file
45+ git add $file
4946
5047$file = " Setup1/Setup1.vdproj"
5148(Get-Content $file ) |
5249 ForEach-Object {
5350 $_ -replace ' "ProductVersion"\s*=\s*"8:.*?"' , " `" ProductVersion`" = `" 8:$version `" "
5451 } | Set-Content $file
52+ git add $file
5553
56- # git add .
57- # git commit -m "Update version to $version"
54+ # Only commit if some change was actually staged (to prevent setting error level)
55+ if (git diff -- cached -- name- only) {
56+ git commit - m " $version Release"
57+ }
0 commit comments