-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsr.ps1
More file actions
60 lines (56 loc) · 1.98 KB
/
Copy pathsr.ps1
File metadata and controls
60 lines (56 loc) · 1.98 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
60
param(
[Parameter(Position = 0)]
[string]$Cmd = "dev",
[Parameter(Position = 1)]
[string]$Arg,
[Parameter(Position = 2)]
[string]$Flag
)
$ErrorActionPreference = "Stop"
$r = $PSScriptRoot
switch -Regex ($Cmd.ToLower()) {
"^(dev|run)$" {
& "$r/scripts/ensure-pie.ps1" -RepoRoot $r | Out-Null
& "$r/scripts/publish-dns-helper.ps1" -Configuration Debug
$devBin = Join-Path $r "src/Stackroot.App/bin/Debug/net8.0-windows"
$runningDev = Get-Process -Name Stackroot -ErrorAction SilentlyContinue |
Where-Object { $_.Path -and $_.Path.StartsWith($devBin, [StringComparison]::OrdinalIgnoreCase) }
if ($runningDev) {
Write-Warning "Stackroot dev build is already running (PID $($runningDev.Id -join ', ')). Close it first or rebuild may fail."
}
dotnet run --project "$r/src/Stackroot.App/Stackroot.App.csproj"
exit $LASTEXITCODE
}
"^(pack|release)$" {
& "$r/scripts/pack-release.ps1"
exit $LASTEXITCODE
}
"^(build|compile|sb)$" {
& "$r/scripts/build.ps1" @args
exit $LASTEXITCODE
}
"^stop-workers$" {
& "$r/scripts/stop-build-workers.ps1"
exit $LASTEXITCODE
}
"^push$" {
if ([string]::IsNullOrWhiteSpace($Arg)) {
Write-Host "Usage: ./sr push {version} [+]"
Write-Host "Example: ./sr push 0.2.6 # csproj must already match"
Write-Host " ./sr push 0.2.6 + # update csproj, commit, then push"
exit 1
}
$bump = ($Flag -eq '+') -or ($Arg.TrimEnd() -match '\+$')
$version = $Arg.Trim().TrimEnd('+').Trim()
& "$r/scripts/push-release.ps1" -Version $version -BumpVersion:$bump
exit $LASTEXITCODE
}
"^changelog$" {
& "$r/scripts/merge-release-notes.ps1"
exit $LASTEXITCODE
}
default {
Write-Host "Usage: ./sr dev|build|pack|push {version} [+]|changelog|stop-workers"
exit 1
}
}