Files
vfxreview/RenderWorker/scripts/publish.ps1
T
twotalesanimation ca9a004d56 fix(worker): package the preview script reliably on an incremental publish
The .NET 10 SDK cleans the publish directory, and an incremental build
then skips copying content into it — so a second publish produced a
package with the exe but no scripts\vfxr_build_preview.jsx. The exe loads
that script from its own folder at runtime, so the package would have
installed cleanly and failed every preview job.

The Content item now sets CopyToPublishDirectory explicitly
(CopyToOutputDirectory only governs the build folder), and publish.ps1
copies the script itself rather than trusting the SDK, keeping the
existing verification as the backstop that caught this.

Verified by publishing twice in a row: the incremental second run, which
previously failed, now produces a complete package and zip.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-13 15:19:47 +02:00

75 lines
2.9 KiB
PowerShell

<#
.SYNOPSIS
Packages the RenderWorker for installation on another machine.
.DESCRIPTION
Produces a self-contained single-file build (no .NET runtime needed on the
target) plus the headless AE build script, and zips it for copying.
.EXAMPLE
.\publish.ps1
.\publish.ps1 -Zip
#>
[CmdletBinding()]
param(
[string]$OutDir = "",
[switch]$Zip
)
$ErrorActionPreference = "Stop"
$root = Split-Path $PSScriptRoot -Parent
if (-not $OutDir) { $OutDir = Join-Path $root "publish\win-x64" }
# Stamp the commit into the version so a deployed exe can be traced back to
# source ("1.1.0+feb1c7b"). Absent git, the plain version still publishes.
$sha = ""
try { $sha = (& git -C $root rev-parse --short HEAD 2>$null) } catch { }
if ($LASTEXITCODE -ne 0) { $sha = "" }
Write-Host "Publishing self-contained worker..." -ForegroundColor Cyan
$publishArgs = @(
(Join-Path $root "VFXReviewWorker\VFXReviewWorker.csproj")
"-c"; "Release"; "-r"; "win-x64"
"--self-contained"; "true"
"-p:PublishSingleFile=true"
"-o"; $OutDir
)
if ($sha) { $publishArgs += "-p:SourceRevisionId=$sha" }
& dotnet publish @publishArgs
if ($LASTEXITCODE -ne 0) { throw "dotnet publish failed" }
# The exe reads scripts\vfxr_build_preview.jsx from its own folder at runtime,
# so it is copied here unconditionally rather than trusted to the SDK: an
# incremental publish into a cleaned output directory silently skips content
# copying, which produced a package that looked fine and could not build a
# preview. Copy, then verify.
$scriptSrc = Join-Path $PSScriptRoot "vfxr_build_preview.jsx"
$scriptOut = Join-Path $OutDir "scripts\vfxr_build_preview.jsx"
if (-not (Test-Path $scriptSrc)) { throw "Preview build script not found in source: $scriptSrc" }
New-Item -ItemType Directory -Force (Split-Path $scriptOut) | Out-Null
Copy-Item $scriptSrc $scriptOut -Force
if (-not (Test-Path $scriptOut)) { throw "Preview build script missing from output: $scriptOut" }
Remove-Item (Join-Path $OutDir "*.pdb") -ErrorAction SilentlyContinue
Write-Host ""
Write-Host "Package contents:" -ForegroundColor Green
Get-ChildItem $OutDir -Recurse -File | ForEach-Object {
Write-Host (" {0,-40} {1,8:N0} KB" -f $_.FullName.Substring($OutDir.Length).TrimStart('\'), ($_.Length / 1KB))
}
if ($Zip) {
$zipPath = Join-Path $root ("VFXReviewWorker_{0}.zip" -f (Get-Date -Format "yyyyMMdd"))
if (Test-Path $zipPath) { Remove-Item $zipPath }
Compress-Archive -Path (Join-Path $OutDir "*") -DestinationPath $zipPath
Write-Host ""
Write-Host "Zipped to: $zipPath" -ForegroundColor Green
}
Write-Host ""
Write-Host "Next on the target machine:" -ForegroundColor Cyan
Write-Host " 1. Copy this folder to e.g. C:\pipeline\VFXReviewWorker"
Write-Host " 2. Create C:\ProgramData\VFXReviewWorker\config.json (see README)"
Write-Host " 3. Verify: .\VFXReviewWorker.exe --check"
Write-Host " 4. Install: sc.exe create VFXReviewRenderWorker binPath= ... start= auto obj= ... password= ..."