47 lines
2.1 KiB
PowerShell
47 lines
2.1 KiB
PowerShell
<#
|
|
Publish gateway + CDN as Windows self-contained exes (runtime + ASP.NET bundled; no .NET install needed on server).
|
|
Run on a machine WITH the .NET 10 SDK (dotnet publish needs the SDK).
|
|
Usage: powershell -ExecutionPolicy Bypass -File deploy\windows\publish.ps1
|
|
Output: deploy\windows\out\gateway\XWorld.Server.Gateway.Runner.exe
|
|
deploy\windows\out\cdn\XWorld.Server.Cdn.Runner.exe
|
|
deploy\windows\out\xworld-server.zip (copy this one file to the server and unzip)
|
|
IMPORTANT: run the exe from out\ (self-contained), NOT from Server\...\bin\Release\net10.0\
|
|
(that build is framework-dependent and needs the runtime installed).
|
|
Use -NoZip to skip packaging.
|
|
#>
|
|
param(
|
|
[string]$Configuration = "Release",
|
|
[string]$Runtime = "win-x64",
|
|
[string]$OutRoot = "$PSScriptRoot\out",
|
|
[switch]$NoZip
|
|
)
|
|
$ErrorActionPreference = "Stop"
|
|
$repo = (Resolve-Path "$PSScriptRoot\..\..").Path
|
|
Write-Host "Repo root : $repo"
|
|
Write-Host "Output : $OutRoot"
|
|
|
|
dotnet publish "$repo\Server\Gateway.Runner\Gateway.Runner.csproj" `
|
|
-c $Configuration -r $Runtime --self-contained true `
|
|
-o "$OutRoot\gateway"
|
|
|
|
dotnet publish "$repo\Server\Cdn.Runner\Cdn.Runner.csproj" `
|
|
-c $Configuration -r $Runtime --self-contained true `
|
|
-o "$OutRoot\cdn"
|
|
|
|
$zip = "$OutRoot\xworld-server.zip"
|
|
if (-not $NoZip)
|
|
{
|
|
if (Test-Path $zip) { Remove-Item $zip -Force }
|
|
Compress-Archive -Path "$OutRoot\gateway", "$OutRoot\cdn" -DestinationPath $zip
|
|
Write-Host "Packaged: $zip" -ForegroundColor Green
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "Done:" -ForegroundColor Green
|
|
Write-Host " gateway exe : $OutRoot\gateway\XWorld.Server.Gateway.Runner.exe"
|
|
Write-Host " cdn exe : $OutRoot\cdn\XWorld.Server.Cdn.Runner.exe"
|
|
if (-not $NoZip) { Write-Host " zip : $zip (copy to server, unzip to C:\xworld\app\)" }
|
|
Write-Host ""
|
|
Write-Host "Run the exe from out\ (self-contained), NOT bin\Release\net10.0\ (needs runtime installed)." -ForegroundColor Yellow
|
|
Write-Host "Next: install-services.ps1 to register Windows services, then configure Caddyfile."
|