57 lines
1.6 KiB
PowerShell
57 lines
1.6 KiB
PowerShell
# Copy of D:\TTRPG-Release\release-all.ps1
|
|
|
|
param(
|
|
[string]$Version = '',
|
|
[switch]$Patch,
|
|
[switch]$Minor,
|
|
[switch]$SkipGit,
|
|
[switch]$SkipLinux,
|
|
[switch]$NoBump,
|
|
[switch]$CheckOnlyPublish
|
|
)
|
|
|
|
Set-StrictMode -Version Latest
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
$ToolDir = $PSScriptRoot
|
|
$PrepareScript = Join-Path $ToolDir 'prepare-release.ps1'
|
|
$PublishScript = Join-Path $ToolDir 'publish.ps1'
|
|
|
|
if (-not (Test-Path -LiteralPath $PrepareScript)) {
|
|
throw "Missing prepare-release.ps1: $PrepareScript"
|
|
}
|
|
if (-not (Test-Path -LiteralPath $PublishScript)) {
|
|
throw "Missing publish.ps1: $PublishScript"
|
|
}
|
|
|
|
$prepareArgs = @()
|
|
if ($Version) { $prepareArgs += '-Version', $Version }
|
|
if ($Patch) { $prepareArgs += '-Patch' }
|
|
if ($Minor) { $prepareArgs += '-Minor' }
|
|
if ($SkipGit) { $prepareArgs += '-SkipGit' }
|
|
if ($SkipLinux) { $prepareArgs += '-SkipLinux' }
|
|
if ($NoBump) { $prepareArgs += '-NoBump' }
|
|
|
|
$publishArgs = @()
|
|
if ($CheckOnlyPublish) { $publishArgs += '-CheckOnly' }
|
|
|
|
Write-Host '=== TTRPG Full Release ===' -ForegroundColor Cyan
|
|
Write-Host ''
|
|
|
|
Write-Host '>>> Phase 1/2: Prepare release' -ForegroundColor Yellow
|
|
& powershell -NoProfile -ExecutionPolicy Bypass -File $PrepareScript @prepareArgs
|
|
if ($LASTEXITCODE -ne 0) {
|
|
throw "Prepare release failed (exit $LASTEXITCODE). Publish not started."
|
|
}
|
|
|
|
Write-Host ''
|
|
Write-Host '>>> Phase 2/2: Publish to server' -ForegroundColor Yellow
|
|
& powershell -NoProfile -ExecutionPolicy Bypass -File $PublishScript @publishArgs
|
|
if ($LASTEXITCODE -ne 0) {
|
|
throw "Publish failed (exit $LASTEXITCODE)"
|
|
}
|
|
|
|
Write-Host ''
|
|
Write-Host '=== Full release completed ===' -ForegroundColor Green
|
|
exit 0
|