Add minversion file generation to build output for downstream jobs

This commit is contained in:
MaddoScientisto 2026-02-22 00:57:23 +01:00
commit 335da52abf

View file

@ -85,6 +85,23 @@ build_windows:
}
& $dotnetExe restore
& $dotnetExe build "imagecatalog\ImageCatalog 2.csproj" -c $env:BUILD_CONFIG -v minimal
# Write a minversion file into the build output so downstream jobs can read the computed version.
try {
$outRoot = Join-Path -Path "imagecatalog\bin\$env:BUILD_CONFIG" -ChildPath '*'
# search under the build output for a file starting with ImageCatalog.
$built = Get-ChildItem -Path (Join-Path "imagecatalog\bin\$env:BUILD_CONFIG" '.') -Recurse -File -ErrorAction SilentlyContinue | Where-Object { $_.Name -like 'ImageCatalog.*' } | Select-Object -First 1
if ($built) {
$base = [System.IO.Path]::GetFileNameWithoutExtension($built.Name)
$version = $base -replace '^ImageCatalog\.', ''
$minPath = Join-Path $built.DirectoryName 'minversion'
Write-Host "Writing minversion '$version' to $minPath"
Set-Content -Path $minPath -Value $version -Encoding UTF8
} else {
Write-Host 'No ImageCatalog build artifact found to derive minversion from.'
}
} catch {
Write-Host "Failed to write minversion: $_"
}
}
artifacts:
paths: