Files
LanMountainDesktop/scripts/Install-Pdcc.ps1

98 lines
3.0 KiB
PowerShell
Raw Permalink Normal View History

Launcher (#4) * 激进的更新 * 试试 * fix.可爱的我一直在修CI( * fix.启动器一定要能够启动 * feat.尝试弄了AOT的启动器。 * fix.修CI,好像是因为Linux那边有个问题,反正修就对了。 * fix.ci难修,为什么liunx跑不起来呢? * Update build.yml * Update LanMountainDesktop.csproj * changed.调整了启动逻辑,优化了更新页面。 * changed.优化了更新体验 * feat.依旧试增量更新这一块,看看velopack * fix.我们试验性地修复了启动器无法正常启动的问题,原因可能是这个画面没有启动,就GUI没显示。然后还把编译问题修了一下。 * fix.继续修ci,ci怎么天天炸 * changed.velopack,试试rust * fix.修ci,修融合桌面,修启动器 * fix.GitHub Action工作流怎么天天出问题 * feat.引入velopack,不好,是rust(至少内存很安全了。 * chore: migrate release pipeline to signed filemap and wire rainyun s3 * fix: make optional s3 upload step workflow-parse safe * fix: make delta pack generation robust for empty diffs and linux paths * chore: rotate launcher update public key for pdc signing * fix: restore stable launcher update public key * fix: sync launcher public key with update signing secret * fix: normalize PEM line endings in signing key validation * fix: rotate launcher public key to match ci signing secret * fix: compare signing keys by SPKI instead of PEM text * refactor update backend to host-managed PDC pipeline * fix release workflow env key collisions * relax publish-pdc precheck to require S3 only * set GH_TOKEN for PDCC installer step * ci: add local pdc mock fallback for release publish * ci: fix pdc mock process log redirection * ci: fallback pdcc signing key to update private key * ci: ensure pdcc signing passphrase env is always set * ci: create pdcc publish root before invoking client * ci: set pdcc version variable from release version * ci: decouple pdcc installer version from publish config version * ci: package pdcc subchannels with generated filemap and changelog * ci: make local pdc mock diff return empty for fast fallback * ci: fix pdcc variable mapping and pdc signing prechecks * Update App.axaml.cs * ci: wire aws cli credentials for rainyun s3 * ci: pin pdcc client version separately from app version * ci: harden local pdc mock transport handling * ci: publish pdcc subchannels in one pass * ci: add pdcc publish heartbeat and timeout * ci: fix pdcc publish workdir bootstrap * feat.Penguin Logistics Online Network Distribution System * ci: fix plonds s3 probe and signing fallback * ci: validate signing key and quiet missing baselines * ci: relax aws checksum mode for rainyun s3 * ci: avoid multipart uploads to rainyun s3 * ci: handle empty plonds baselines safely * ci.plonds * Rebuild release pipeline around PLONDS and DDSS * Fix Windows installer script path in release workflow
2026-04-21 20:59:52 +08:00
param(
[string]$Repository = "ClassIsland/PhainonDistributionCenter",
[string]$AssetName = "out_app_linux_x64.zip",
[string]$Version = "",
[string]$OutputDir = (Join-Path $PSScriptRoot "..\pdcc")
)
$ErrorActionPreference = "Stop"
if ([string]::IsNullOrWhiteSpace($Repository)) {
throw "Repository is required."
}
if ([string]::IsNullOrWhiteSpace($AssetName)) {
throw "AssetName is required."
}
$OutputDir = [System.IO.Path]::GetFullPath($OutputDir)
if (-not (Test-Path -LiteralPath $OutputDir)) {
New-Item -ItemType Directory -Path $OutputDir -Force | Out-Null
}
$clientName = if ($env:OS -eq "Windows_NT") { "PhainonDistributionCenter.Client.exe" } else { "PhainonDistributionCenter.Client" }
$clientPath = Join-Path $OutputDir $clientName
if (Test-Path -LiteralPath $clientPath) {
Write-Host "PDCC client already installed at $clientPath"
return
}
$releaseTag = $Version
if ([string]::IsNullOrWhiteSpace($releaseTag)) {
$releaseTag = $env:PDC_CLIENT_VERSION
}
if ([string]::IsNullOrWhiteSpace($releaseTag)) {
$releaseTag = $env:PDCC_VERSION
}
$tempDir = Join-Path $env:RUNNER_TEMP "pdcc-install"
if (Test-Path -LiteralPath $tempDir) {
Remove-Item -LiteralPath $tempDir -Recurse -Force
}
New-Item -ItemType Directory -Path $tempDir -Force | Out-Null
$zipPath = Join-Path $tempDir $AssetName
if (Get-Command gh -ErrorAction SilentlyContinue) {
Write-Host "Downloading PDCC via gh release download from $Repository ..."
$ghArgs = @("release", "download", "--repo", $Repository, "--pattern", $AssetName, "--dir", $tempDir, "--clobber")
if (-not [string]::IsNullOrWhiteSpace($releaseTag)) {
$ghArgs = @("release", "download", $releaseTag, "--repo", $Repository, "--pattern", $AssetName, "--dir", $tempDir, "--clobber")
}
& gh @ghArgs
if ($LASTEXITCODE -ne 0) {
throw "gh release download failed for $Repository/$AssetName."
}
}
else {
if ([string]::IsNullOrWhiteSpace($releaseTag)) {
throw "PDCC_VERSION is required when gh is unavailable."
}
$downloadUrl = "https://github.com/$Repository/releases/download/$releaseTag/$AssetName"
Write-Host "Downloading PDCC from $downloadUrl ..."
Invoke-WebRequest -Uri $downloadUrl -OutFile $zipPath
}
$extractDir = Join-Path $tempDir "extract"
if (Test-Path -LiteralPath $extractDir) {
Remove-Item -LiteralPath $extractDir -Recurse -Force
}
New-Item -ItemType Directory -Path $extractDir -Force | Out-Null
Expand-Archive -LiteralPath $zipPath -DestinationPath $extractDir -Force
$copied = $false
foreach ($file in Get-ChildItem -LiteralPath $extractDir -Recurse -File) {
if ($file.Name -ieq $clientName) {
Copy-Item -LiteralPath $file.FullName -Destination $clientPath -Force
$copied = $true
break
}
}
if (-not $copied) {
throw "PDCC client executable not found in downloaded archive."
}
if ($IsLinux) {
try {
chmod +x $clientPath | Out-Null
}
catch {
}
}
Write-Host "PDCC installed to $clientPath"