43 lines
1.7 KiB
PowerShell
43 lines
1.7 KiB
PowerShell
$ErrorActionPreference = 'Stop'
|
|
|
|
$projectRoot = Split-Path -Parent $PSScriptRoot
|
|
$releaseRoot = [System.IO.Path]::GetFullPath((Join-Path $projectRoot 'release\TaskPilot'))
|
|
$expectedPrefix = [System.IO.Path]::GetFullPath((Join-Path $projectRoot 'release')).TrimEnd('\') + '\'
|
|
if (-not $releaseRoot.StartsWith($expectedPrefix, [System.StringComparison]::OrdinalIgnoreCase)) {
|
|
throw "Refusing to build outside release directory: $releaseRoot"
|
|
}
|
|
|
|
function Assert-ExitCode {
|
|
param([string]$Step)
|
|
|
|
if ($LASTEXITCODE -ne 0) {
|
|
throw "$Step failed with exit code $LASTEXITCODE"
|
|
}
|
|
}
|
|
|
|
Push-Location $projectRoot
|
|
try {
|
|
pnpm --dir frontend build
|
|
Assert-ExitCode 'Frontend build'
|
|
cargo build --release --bin task-pilot-backend --manifest-path backend\Cargo.toml
|
|
Assert-ExitCode 'Rust release build'
|
|
|
|
if (Test-Path -LiteralPath $releaseRoot) {
|
|
Remove-Item -LiteralPath $releaseRoot -Recurse -Force
|
|
}
|
|
[void](New-Item -ItemType Directory -Path $releaseRoot -Force)
|
|
[void](New-Item -ItemType Directory -Path (Join-Path $releaseRoot 'web') -Force)
|
|
[void](New-Item -ItemType Directory -Path (Join-Path $releaseRoot 'data') -Force)
|
|
[void](New-Item -ItemType Directory -Path (Join-Path $releaseRoot 'logs') -Force)
|
|
|
|
Copy-Item -LiteralPath 'backend\target\release\task-pilot-backend.exe' -Destination $releaseRoot
|
|
Copy-Item -LiteralPath 'scripts\start.ps1' -Destination $releaseRoot
|
|
Copy-Item -Path 'frontend\dist\*' -Destination (Join-Path $releaseRoot 'web') -Recurse
|
|
Copy-Item -LiteralPath 'docs\RELEASE.md' -Destination (Join-Path $releaseRoot 'README.md')
|
|
|
|
Write-Host "Release package: $releaseRoot"
|
|
}
|
|
finally {
|
|
Pop-Location
|
|
}
|