mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-06-23 01:44:26 +08:00
ci: publish pdcc subchannels in one pass
This commit is contained in:
33
.github/workflows/release.yml
vendored
33
.github/workflows/release.yml
vendored
@@ -980,6 +980,7 @@ jobs:
|
|||||||
$payloadRoot = Join-Path $PWD "payload-artifacts"
|
$payloadRoot = Join-Path $PWD "payload-artifacts"
|
||||||
$installerRoot = Join-Path $PWD "installer-artifacts"
|
$installerRoot = Join-Path $PWD "installer-artifacts"
|
||||||
$outRoot = Join-Path $PWD "pdc-output"
|
$outRoot = Join-Path $PWD "pdc-output"
|
||||||
|
$publishRoot = Join-Path $outRoot "published"
|
||||||
$client = Join-Path $PWD "pdcc/PhainonDistributionCenter.Client"
|
$client = Join-Path $PWD "pdcc/PhainonDistributionCenter.Client"
|
||||||
$config = Join-Path $PWD "pdc-work/phainon.resolved.yml"
|
$config = Join-Path $PWD "pdc-work/phainon.resolved.yml"
|
||||||
|
|
||||||
@@ -991,6 +992,7 @@ jobs:
|
|||||||
}
|
}
|
||||||
New-Item -ItemType Directory -Path $stageRoot -Force | Out-Null
|
New-Item -ItemType Directory -Path $stageRoot -Force | Out-Null
|
||||||
New-Item -ItemType Directory -Path $outRoot -Force | Out-Null
|
New-Item -ItemType Directory -Path $outRoot -Force | Out-Null
|
||||||
|
New-Item -ItemType Directory -Path $publishRoot -Force | Out-Null
|
||||||
|
|
||||||
$payloadArtifacts = Get-ChildItem -LiteralPath $payloadRoot -Directory
|
$payloadArtifacts = Get-ChildItem -LiteralPath $payloadRoot -Directory
|
||||||
if (-not $payloadArtifacts) {
|
if (-not $payloadArtifacts) {
|
||||||
@@ -1012,8 +1014,6 @@ jobs:
|
|||||||
$stagedPayloadDir = Join-Path $stageRoot "payloads/$platformKey"
|
$stagedPayloadDir = Join-Path $stageRoot "payloads/$platformKey"
|
||||||
./scripts/Prepare-PdccOut.ps1 -SourceDir $payloadArtifact.FullName -OutputDir $stagedPayloadDir
|
./scripts/Prepare-PdccOut.ps1 -SourceDir $payloadArtifact.FullName -OutputDir $stagedPayloadDir
|
||||||
|
|
||||||
$publishRoot = Join-Path $outRoot "published/$platformKey"
|
|
||||||
New-Item -ItemType Directory -Path $publishRoot -Force | Out-Null
|
|
||||||
$parts = $platformKey.Split('-', 2)
|
$parts = $platformKey.Split('-', 2)
|
||||||
if ($parts.Count -lt 2) {
|
if ($parts.Count -lt 2) {
|
||||||
throw "Invalid platform key format: $platformKey"
|
throw "Invalid platform key format: $platformKey"
|
||||||
@@ -1023,6 +1023,7 @@ jobs:
|
|||||||
$packageName = "LanMountainDesktop_app_${os}_${arch}_release_folder.zip"
|
$packageName = "LanMountainDesktop_app_${os}_${arch}_release_folder.zip"
|
||||||
$packagePath = Join-Path $publishRoot $packageName
|
$packagePath = Join-Path $publishRoot $packageName
|
||||||
|
|
||||||
|
Write-Host "Preparing PDCC subchannel package for $platformKey..."
|
||||||
& $client $config GenerateFileMap $stagedPayloadDir
|
& $client $config GenerateFileMap $stagedPayloadDir
|
||||||
if ($LASTEXITCODE -ne 0) {
|
if ($LASTEXITCODE -ne 0) {
|
||||||
throw "PDCC GenerateFileMap failed for $platformKey."
|
throw "PDCC GenerateFileMap failed for $platformKey."
|
||||||
@@ -1032,18 +1033,28 @@ jobs:
|
|||||||
Remove-Item -LiteralPath $packagePath -Force
|
Remove-Item -LiteralPath $packagePath -Force
|
||||||
}
|
}
|
||||||
Compress-Archive -Path (Join-Path $stagedPayloadDir '*') -DestinationPath $packagePath -Force
|
Compress-Archive -Path (Join-Path $stagedPayloadDir '*') -DestinationPath $packagePath -Force
|
||||||
|
$packageSizeMb = [Math]::Round((Get-Item -LiteralPath $packagePath).Length / 1MB, 2)
|
||||||
|
Write-Host "Prepared package: $packageName ($packageSizeMb MB)"
|
||||||
|
}
|
||||||
|
|
||||||
Push-Location $publishRoot
|
$subchannelPackages = Get-ChildItem -LiteralPath $publishRoot -File -Filter "LanMountainDesktop_app_*_release_folder.zip"
|
||||||
try {
|
if (-not $subchannelPackages) {
|
||||||
& $client $config Publish $env:PRIMARY_VERSION $env:VERSION $publishRoot
|
throw "No PDCC subchannel packages were prepared."
|
||||||
if ($LASTEXITCODE -ne 0) {
|
}
|
||||||
throw "PDCC Publish failed for $platformKey."
|
|
||||||
}
|
Write-Host "Publishing $($subchannelPackages.Count) subchannels in a single PDCC Publish run..."
|
||||||
}
|
$subchannelPackages | Sort-Object Name | ForEach-Object { Write-Host " - $($_.Name)" }
|
||||||
finally {
|
|
||||||
Pop-Location
|
Push-Location $publishRoot
|
||||||
|
try {
|
||||||
|
& $client $config Publish $env:PRIMARY_VERSION $env:VERSION $publishRoot
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
throw "PDCC Publish failed."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
Pop-Location
|
||||||
|
}
|
||||||
|
|
||||||
if (Test-Path (Join-Path $stageRoot "installers")) {
|
if (Test-Path (Join-Path $stageRoot "installers")) {
|
||||||
& aws --endpoint-url "$env:S3_ENDPOINT" --region "$env:S3_REGION" s3 sync (Join-Path $stageRoot "installers") "s3://$env:S3_BUCKET/lanmountain/update/installers/" --only-show-errors
|
& aws --endpoint-url "$env:S3_ENDPOINT" --region "$env:S3_REGION" s3 sync (Join-Path $stageRoot "installers") "s3://$env:S3_BUCKET/lanmountain/update/installers/" --only-show-errors
|
||||||
|
|||||||
Reference in New Issue
Block a user