releases/build/publish.ps1

78 lines
3.5 KiB
PowerShell

# Paca 다중 아키텍처 설치자 빌드 (Inno Setup EXE + WiX MSI)
# 사용: ./build/publish.ps1 [-Config Release] [-Version 1.1.0] [-Archs @("x64", "arm64")]
# 결과: out/Paca-Setup-x64.exe, out/Paca-Setup-x64.msi, out/Paca-Setup-arm64.exe, out/Paca-Setup-arm64.msi
param(
[string]$Config = "Release",
[string]$Version = "1.1.0",
[string[]]$Archs = @("x64", "arm64"),
[switch]$SkipExe,
[switch]$SkipMsi
)
$ErrorActionPreference = "Stop"
$root = Split-Path -Parent $PSScriptRoot # 레포 루트
$app = Join-Path $root "src\Paca.App\Paca.App.csproj"
$iss = Join-Path $PSScriptRoot "installer.iss"
$wxs = Join-Path $PSScriptRoot "Paca.wxs"
$outDir = Join-Path $root "out"
# --- ISCC(=Inno Setup 컴파일러) 위치 해결 ---
$iscc = $null
if (-not $SkipExe) {
foreach ($cand in @(
"${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe",
"$env:ProgramFiles\Inno Setup 6\ISCC.exe",
"$env:LOCALAPPDATA\Programs\Inno Setup 6\ISCC.exe",
"$env:LOCALAPPDATA\Programs\Inno Setup 6.7\ISCC.exe"
)) {
if ($cand -and (Test-Path $cand)) { $iscc = $cand; break }
}
if (-not $iscc) { $iscc = (Get-Command ISCC.exe -ErrorAction SilentlyContinue).Source }
if (-not $iscc) {
throw "Inno Setup(ISCC) 를 찾을 수 없습니다. 설치: winget install --id JRSoftware.InnoSetup -e"
}
Write-Host "ISCC: $iscc" -ForegroundColor DarkGray
}
# --- WiX CLI 위치 확인 ---
if (-not $SkipMsi) {
$wixCmd = Get-Command wix -ErrorAction SilentlyContinue
if (-not $wixCmd) {
throw "WiX Toolset CLI(wix) 를 찾을 수 없습니다. 설치: dotnet tool install --global wix --version 5.0.2"
}
Write-Host "WiX: $($wixCmd.Source)" -ForegroundColor DarkGray
}
New-Item -ItemType Directory -Force -Path $outDir | Out-Null
foreach ($arch in $Archs) {
$rid = "win-$arch"
$pub = Join-Path $root "publish\$arch"
Write-Host ""
Write-Host "==== [$arch] publish ($rid, self-contained) ====" -ForegroundColor Cyan
if (Test-Path $pub) { Remove-Item $pub -Recurse -Force }
# WPF 멀티플랫폼: Platform 축을 RID 와 일치시켜 빌드.
dotnet publish $app -c $Config -r $rid -p:Platform=$arch --self-contained -o $pub
if ($LASTEXITCODE -ne 0) { throw "publish 실패: $rid (exit $LASTEXITCODE). arm64 는 yt-dlp/WebView2 런타임 관련 처음 빌드 시 이슈가 있을 수 있습니다." }
if (-not $SkipExe) {
Write-Host "==== [$arch] Inno Setup 컴파일 (.exe) ====" -ForegroundColor Cyan
& $iscc /Q "/DAPP_VERSION=$Version" "/DARCH=$arch" "/DPUBLISH_DIR=$pub" $iss
if ($LASTEXITCODE -ne 0) { throw "ISCC 실패: $arch (exit $LASTEXITCODE)" }
Write-Host "완료: out\Paca-Setup-$arch.exe" -ForegroundColor Green
}
if (-not $SkipMsi) {
Write-Host "==== [$arch] WiX MSI 컴파일 (.msi) ====" -ForegroundColor Cyan
$msiOut = Join-Path $outDir "Paca-Setup-$arch.msi"
& wix build $wxs -d Version=$Version -d Arch=$arch -d PublishDir=$pub -d SourceDir=$root -arch $arch -o $msiOut
if ($LASTEXITCODE -ne 0) { throw "WiX MSI 실패: $arch (exit $LASTEXITCODE)" }
Write-Host "완료: out\Paca-Setup-$arch.msi" -ForegroundColor Green
}
}
Write-Host ""
Write-Host "설치자 생성 완료:" -ForegroundColor Green
Get-ChildItem (Join-Path $outDir "Paca-Setup-*.*") |
Where-Object { $_.Extension -in @(".exe", ".msi") } |
ForEach-Object { Write-Host (" {0,-38} {1:N1} MB" -f $_.Name, ($_.Length / 1MB)) }