releases/build/publish.ps1

52 lines
2.4 KiB
PowerShell

# VideoDownloader 다중 아키텍처 설치자 빌드
# 사용: ./build/publish.ps1 [-Config Release] [-Version 1.0.0]
# 결과: out/VideoDownloader-Setup-x64.exe, out/VideoDownloader-Setup-arm64.exe
param(
[string]$Config = "Release",
[string]$Version = "1.0.0",
[string[]]$Archs = @("x64", "arm64")
)
$ErrorActionPreference = "Stop"
$root = Split-Path -Parent $PSScriptRoot # 레포 루트
$app = Join-Path $root "VideoDownloader.App\VideoDownloader.App.csproj"
$iss = Join-Path $PSScriptRoot "installer.iss"
$outDir = Join-Path $root "out"
# --- ISCC(=Inno Setup 컴파일러) 위치 해결 ---
$iscc = $null
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
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 런타임 관련 처음 빌드 시 이슈가 있을 수 있습니다." }
Write-Host "==== [$arch] Inno Setup 컴파일 ====" -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\VideoDownloader-Setup-$arch.exe" -ForegroundColor Green
}
Write-Host ""
Write-Host "설치자 생성 완료:" -ForegroundColor Green
Get-ChildItem (Join-Path $outDir "VideoDownloader-Setup-*.exe") |
ForEach-Object { Write-Host (" {0,-38} {1:N1} MB" -f $_.Name, ($_.Length / 1MB)) }