Files
AmiReel/publish-win-x64.ps1
T
klevze e635b708a2 Improve crop editor and copy publish output to dist
Add resize handles, zoom, view brightness, and a multi-frame still
strip. Keep the crop box on mouse-up, and copy AmiReel.exe to dist.
2026-08-15 22:59:20 +02:00

66 lines
2.3 KiB
PowerShell

[CmdletBinding()]
param()
$ErrorActionPreference = 'Stop'
$projectDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$ffmpeg = Join-Path $projectDir 'ThirdParty\ffmpeg.exe'
$ffprobe = Join-Path $projectDir 'ThirdParty\ffprobe.exe'
if (-not (Test-Path $ffmpeg) -or -not (Test-Path $ffprobe)) {
throw 'Add ffmpeg.exe and ffprobe.exe to ThirdParty before publishing.'
}
$projectPath = Join-Path $projectDir 'AmiReel.csproj'
$releaseDir = Join-Path $projectDir 'bin\Release\net10.0-windows10.0.26100.0\win-x64'
$releaseExe = Join-Path $releaseDir 'AmiReel.exe'
$publishDir = Join-Path $releaseDir 'publish'
$publishExe = Join-Path $publishDir 'AmiReel.exe'
$distDir = Join-Path $projectDir 'dist'
$distExe = Join-Path $distDir 'AmiReel.exe'
$publishArguments = @(
'publish', $projectPath,
'-c', 'Release',
'-r', 'win-x64',
'--self-contained', 'true',
'-p:WindowsPackageType=None',
'-p:PublishSingleFile=true',
'-p:IncludeNativeLibrariesForSelfExtract=true',
'-p:EnableCompressionInSingleFile=true'
)
if ((Test-Path $releaseExe) -or (Test-Path $publishExe) -or (Test-Path $distExe)) {
$runningReleaseInstances = Get-Process | Where-Object {
$_.Path -and (
[string]::Equals($_.Path, $releaseExe, [System.StringComparison]::OrdinalIgnoreCase) -or
[string]::Equals($_.Path, $publishExe, [System.StringComparison]::OrdinalIgnoreCase) -or
[string]::Equals($_.Path, $distExe, [System.StringComparison]::OrdinalIgnoreCase)
)
}
if ($runningReleaseInstances) {
Write-Host 'Stopping running AmiReel build before publish...' -ForegroundColor Yellow
$runningReleaseInstances | Stop-Process -Force
Start-Sleep -Milliseconds 800
}
}
if (Test-Path $publishDir) {
Remove-Item -LiteralPath $publishDir -Recurse -Force -ErrorAction SilentlyContinue
}
& dotnet @publishArguments
if ($LASTEXITCODE -ne 0) {
throw "dotnet publish failed with exit code $LASTEXITCODE."
}
if (-not (Test-Path $publishExe)) {
throw "Published executable was not found at $publishExe."
}
New-Item -ItemType Directory -Path $distDir -Force | Out-Null
Copy-Item -LiteralPath $publishExe -Destination $distExe -Force
Write-Host "Published AmiReel to $distDir" -ForegroundColor Green
Write-Host "Executable: $distExe" -ForegroundColor Cyan