55 lines
1.5 KiB
PowerShell
55 lines
1.5 KiB
PowerShell
# Full release: prepare (version, git, build, copy) then publish (validate + upload).
|
|
# Run: release.cmd
|
|
|
|
param(
|
|
[string]$Version = '',
|
|
[switch]$Minor,
|
|
[switch]$SkipGit,
|
|
[switch]$SkipLinux,
|
|
[switch]$NoBump,
|
|
[switch]$CheckOnly
|
|
)
|
|
|
|
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 in $ToolDir"
|
|
}
|
|
if (-not (Test-Path -LiteralPath $PublishScript)) {
|
|
throw "Missing publish.ps1 in $ToolDir"
|
|
}
|
|
|
|
Write-Host '=== TTRPG Full Release ===' -ForegroundColor Cyan
|
|
Write-Host 'Step A: prepare-release'
|
|
Write-Host 'Step B: publish (after prepare succeeds)'
|
|
Write-Host ''
|
|
|
|
$prepareArgs = @('-File', $PrepareScript)
|
|
if ($Version) { $prepareArgs += '-Version', $Version }
|
|
if ($Minor) { $prepareArgs += '-Minor' }
|
|
if ($SkipGit) { $prepareArgs += '-SkipGit' }
|
|
if ($SkipLinux) { $prepareArgs += '-SkipLinux' }
|
|
if ($NoBump) { $prepareArgs += '-NoBump' }
|
|
|
|
& powershell -NoProfile -ExecutionPolicy Bypass @prepareArgs
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Host ''
|
|
Write-Host 'Prepare failed. Publish was not started.' -ForegroundColor Red
|
|
exit $LASTEXITCODE
|
|
}
|
|
|
|
Write-Host ''
|
|
Write-Host 'Prepare finished. Starting publish...' -ForegroundColor Green
|
|
Write-Host ''
|
|
|
|
$publishArgs = @('-File', $PublishScript)
|
|
if ($CheckOnly) { $publishArgs += '-CheckOnly' }
|
|
|
|
& powershell -NoProfile -ExecutionPolicy Bypass @publishArgs
|
|
exit $LASTEXITCODE
|