| 1 | # Publish reference intercom-service (self-contained win-x64 by default). |
| 2 | # Run from repo root: .\scripts\intercom\publish-intercom-service.ps1 |
| 3 | # Optional: -Configuration Debug -OutDir "D:\cascade-ide\tools\intercom-service" |
| 4 | [CmdletBinding()] |
| 5 | param( |
| 6 | [ValidateSet("Debug", "Release")] |
| 7 | [string] $Configuration = "Release", |
| 8 | |
| 9 | [string] $Runtime = "win-x64", |
| 10 | |
| 11 | [switch] $SelfContained, |
| 12 | |
| 13 | [string] $OutDir = "" |
| 14 | ) |
| 15 | |
| 16 | $ErrorActionPreference = "Stop" |
| 17 | $repoRoot = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot "..\..")) |
| 18 | $csproj = Join-Path $repoRoot "host\intercom-service\src\IntercomService\IntercomService.csproj" |
| 19 | if (-not (Test-Path -LiteralPath $csproj)) { |
| 20 | Write-Error "IntercomService.csproj not found at $csproj" |
| 21 | exit 1 |
| 22 | } |
| 23 | |
| 24 | if ([string]::IsNullOrWhiteSpace($OutDir)) { |
| 25 | $OutDir = Join-Path $repoRoot "artifacts\intercom-service" |
| 26 | } |
| 27 | |
| 28 | $publishArgs = @( |
| 29 | "publish", $csproj, |
| 30 | "-c", $Configuration, |
| 31 | "-r", $Runtime, |
| 32 | "-o", $OutDir, |
| 33 | "-v", "minimal" |
| 34 | ) |
| 35 | if ($SelfContained) { |
| 36 | $publishArgs += "--self-contained", "true" |
| 37 | } else { |
| 38 | $publishArgs += "--self-contained", "false" |
| 39 | } |
| 40 | |
| 41 | Push-Location $repoRoot |
| 42 | try { |
| 43 | & dotnet @publishArgs |
| 44 | if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } |
| 45 | |
| 46 | $exe = Join-Path $OutDir "IntercomService.exe" |
| 47 | if (-not (Test-Path -LiteralPath $exe)) { |
| 48 | Write-Error "Expected exe not found: $exe" |
| 49 | exit 1 |
| 50 | } |
| 51 | |
| 52 | $ts = (Get-Item -LiteralPath $exe).LastWriteTimeUtc.ToString("o") |
| 53 | Write-Host "OK: $exe (UTC $ts)" |
| 54 | Write-Host "Deploy: publish-release.ps1 copies to <Target>/tools/intercom-service/ (default local_server_path in settings.toml)." |
| 55 | } finally { |
| 56 | Pop-Location |
| 57 | } |
| 58 | |