Repository navigation
Expand file tree
/
Copy pathprepare-release.ps1
More file actions
59 lines (46 loc) · 2.61 KB
/
Copy pathprepare-release.ps1
File metadata and controls
59 lines (46 loc) · 2.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# ShellUI Native Release Preparation Script
# Updates version in Directory.Build.props and prepares for release
param(
[Parameter(Mandatory=$true)]
[string]$Version,
[string]$Suffix = ""
)
$ErrorActionPreference = "Stop"
Write-Host "Preparing ShellUI Native release v$Version" -ForegroundColor Cyan
# Update Directory.Build.props
$propsPath = Join-Path $PSScriptRoot "Directory.Build.props"
$content = Get-Content $propsPath -Raw
$content = $content -replace '<ShellUINativeVersion>[^<]+</ShellUINativeVersion>', "<ShellUINativeVersion>$Version</ShellUINativeVersion>"
$content = $content -replace '<ShellUINativeVersionSuffix>[^<]*</ShellUINativeVersionSuffix>', "<ShellUINativeVersionSuffix>$Suffix</ShellUINativeVersionSuffix>"
Set-Content $propsPath $content
Write-Host "Updated Directory.Build.props to version $Version" -ForegroundColor Green
# The README's version badge is static (a live NuGet lookup sometimes fails to load on GitHub)
$fullVersion = if ($Suffix) { "$Version-$Suffix" } else { $Version }
$readmePath = Join-Path $PSScriptRoot "docs/README.md"
$readme = [System.IO.File]::ReadAllText($readmePath)
$readme = $readme -replace 'badge/CLI-v[^?"]+-004880', "badge/CLI-v$($fullVersion.Replace('-', '--'))-004880"
$readme = $readme -replace 'alt="ShellUI\.Native\.CLI v[^"]* on NuGet"', "alt=`"ShellUI.Native.CLI v$fullVersion on NuGet`""
[System.IO.File]::WriteAllText($readmePath, $readme)
Write-Host "Updated the version badge in docs/README.md" -ForegroundColor Green
# Build and test (the MAUI demo is left out; it needs the MAUI workload)
Write-Host "Building and testing..." -ForegroundColor Cyan
dotnet test (Join-Path $PSScriptRoot "tests/ShellUI.Native.Tests/ShellUI.Native.Tests.csproj") -c Release
if ($LASTEXITCODE -ne 0) {
Write-Host "Build or tests failed!" -ForegroundColor Red
exit 1
}
# Only the CLI is published; Core and Templates ship inside the tool package
Write-Host "Packing the CLI..." -ForegroundColor Cyan
dotnet pack (Join-Path $PSScriptRoot "src/ShellUI.Native.CLI/ShellUI.Native.CLI.csproj") -c Release -o (Join-Path $PSScriptRoot "nupkg")
if ($LASTEXITCODE -ne 0) {
Write-Host "Pack failed!" -ForegroundColor Red
exit 1
}
Write-Host ""
Write-Host "Release preparation complete! Package: ./nupkg" -ForegroundColor Green
Write-Host ""
Write-Host "Next:" -ForegroundColor Yellow
Write-Host " 1. Add a '# ShellUI Native v$fullVersion' section to docs/RELEASE_NOTES.md"
Write-Host " 2. Merge to main, then tag it; the Release workflow publishes to NuGet:"
Write-Host " git tag -a v$fullVersion -m `"ShellUI Native v$fullVersion`""
Write-Host " git push origin v$fullVersion"