File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ param (
2+ [string ]$version
3+ )
4+
5+ $version_underscored = $version -replace ' \.' , ' _'
6+ $setup_link = " https://github.com/Ellendar/Z2Randomizer/releases/download/$version /Z2Randomizer_${version_underscored} .msi"
7+ $pub_date = Get-Date - Format " dddd, dd MMMM yyyy"
8+
9+ # Update appcast.xml
10+ $file = " appcast.xml"
11+ $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+
18+ if ($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 = @"
24+ <item>
25+ <title>Version $version </title>
26+ <description>
27+ <![CDATA[
28+ See the <a href=""https://github.com/Ellendar/Z2Randomizer/blob/main/PatchNotes.md"">changelog</a> for details about new features.
29+ ]]>
30+ </description>
31+ <pubDate>$pub_date </pubDate>
32+ <enclosure url=""$setup_link "" sparkle:version=""$version "" />
33+ </item>
34+ "@
35+
36+ Set-Content $file ($before + $app_cast_item + $after )
37+
38+ $file = " Directory.Build.targets"
39+ (Get-Content $file ) |
40+ ForEach-Object {
41+ $_ -replace ' <Version>.*?</Version>' , " <Version>$version </Version>"
42+ } | Set-Content $file
43+
44+ $file = " README.md"
45+ (Get-Content $file ) |
46+ ForEach-Object {
47+ $_ -replace ' \[Download\]\([^)]*\)' , " [Download]($setup_link )"
48+ } | Set-Content $file
49+
50+ $file = " Setup1/Setup1.vdproj"
51+ (Get-Content $file ) |
52+ ForEach-Object {
53+ $_ -replace ' "ProductVersion"\s*=\s*"8:.*?"' , " `" ProductVersion`" = `" 8:$version `" "
54+ } | Set-Content $file
55+
56+ # git add .
57+ # git commit -m "Update version to $version"
You can’t perform that action at this time.
0 commit comments