ci: parallelize release components

This commit is contained in:
justme committed 2026-10-04 11:44:41 -07:00
1 parent 50d8c07939
commit 17a69c1c7a
5 files changed
+176 -116

No files matched your search

+20 -12
View File
@@ -1,7 +1,10 @@
param(
[Parameter(Mandatory)]
[ValidateSet('amd64', 'arm64')]
[string]$Architecture
[string]$Architecture,
[Parameter(Mandatory)]
[ValidateSet('agent', 'probe')]
[string]$Role
)
$ErrorActionPreference = 'Stop'
@@ -38,14 +41,15 @@ foreach ($line in $environmentLines) {
}
}
$buildRoot = Join-Path $root ".release\build\windows-$Architecture-$PID"
$publishRoot = Join-Path $root ".release\windows-$Architecture-$PID"
$buildRoot = Join-Path $root ".release\build\windows-$Architecture-$Role-$PID"
$publishRoot = Join-Path $root ".release\windows-$Architecture-$Role-$PID"
$packageRoot = Join-Path $root '.release\packages'
$null = New-Item -ItemType Directory -Force -Path $publishRoot, $packageRoot
function Publish-Aot([string]$Project, [string]$Output) {
$arguments = @(
'publish', $Project,
'-m:3',
'-c', 'Release',
'-r', $rid,
'--self-contained', 'true',
@@ -67,13 +71,18 @@ function Publish-Aot([string]$Project, [string]$Output) {
}
}
$agentOut = Join-Path $publishRoot 'agent'
$probeOut = Join-Path $publishRoot 'probe'
$enrollOut = Join-Path $publishRoot 'fleet-enroll'
$null = New-Item -ItemType Directory -Force -Path $agentOut, $probeOut, $enrollOut
Publish-Aot 'agent/src/Monitor.Agent' $agentOut
Publish-Aot 'probe/src/Monitor.Probe' $probeOut
Publish-Aot 'fleet/tools/fleet-enroll' $enrollOut
$roleOut = Join-Path $publishRoot $Role
$null = New-Item -ItemType Directory -Force -Path $roleOut
$enrollOut = $null
if ($Role -eq 'agent') {
Publish-Aot 'agent/src/Monitor.Agent' $roleOut
$enrollOut = Join-Path $publishRoot 'fleet-enroll'
$null = New-Item -ItemType Directory -Force -Path $enrollOut
Publish-Aot 'fleet/tools/fleet-enroll' $enrollOut
}
else {
Publish-Aot 'probe/src/Monitor.Probe' $roleOut
}
$giteaBase = if ($env:GITEA_BASE) { $env:GITEA_BASE.TrimEnd('/') } else { 'http://localhost:3100' }
$netrc = Join-Path $env:TEMP ("monitor-gitea-$([guid]::NewGuid().ToString('N')).netrc")
@@ -118,8 +127,7 @@ function Publish-Package([string]$Role, [string]$BinaryDirectory) {
}
try {
Publish-Package 'agent' $agentOut
Publish-Package 'probe' $probeOut
Publish-Package $Role $roleOut
}
finally {
Remove-Item -LiteralPath $netrc -Force -ErrorAction SilentlyContinue