Unity release scripts: run the semver check after the build, with the built DLLs
The check moves from before the build to once the assemblies under judgement exist, and receives every shipped GameCult.* DLL (cultlib) or the fresh CultMath.dll with the baseline path of the previous tag's tracked plugins. The early calls are deleted; each script keeps exactly one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
8f2eab7651
commit
b8e1f7e0f6
2 changed files with 43 additions and 34 deletions
|
|
@ -27,25 +27,6 @@ if (Test-Path -LiteralPath $outputRoot) {
|
|||
Remove-Item -LiteralPath $outputRoot -Recurse -Force
|
||||
}
|
||||
|
||||
# docs/semver-policy.md (CultLib root, two levels up from this script):
|
||||
# refuse to build a release whose CHANGELOG.md entry claims a breaking change
|
||||
# under too small a bump, or whose version skips or reverses the previous
|
||||
# published tag. Runs before the build below so a bad version number fails
|
||||
# fast. cultmath is pre-1.0 (0.y.z): a breaking change must be at least a
|
||||
# minor bump. $repoRoot above is this package's own root (packages\cultmath),
|
||||
# not CultLib's; the shared checker script lives one level above that.
|
||||
$cultLibRoot = Split-Path -Parent (Split-Path -Parent $repoRoot)
|
||||
$cultmathVersion = (Get-Content -LiteralPath (Join-Path $templateRoot "package.json") -Raw | ConvertFrom-Json).version
|
||||
& node (Join-Path $cultLibRoot "scripts\check-changelog-semver.mjs") `
|
||||
--package "org.gamecult.cultmath" `
|
||||
--changelog (Join-Path $templateRoot "CHANGELOG.md") `
|
||||
--version $cultmathVersion `
|
||||
--tag-prefix "cultmath-unity" `
|
||||
--cwd $cultLibRoot
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "CultMath Unity package failed the semver policy check (see docs/semver-policy.md)."
|
||||
}
|
||||
|
||||
# The tracked DLL and pdb are committed beside their source, so neither may name a commit: Source Link
|
||||
# writes the commit SHA into the pdb, and the DLL carries that pdb's content id.
|
||||
dotnet build $projectPath -c $Configuration -f netstandard2.1 -o $buildRoot --no-incremental `
|
||||
|
|
@ -60,6 +41,25 @@ foreach ($path in @($freshAssembly, $freshSymbols)) {
|
|||
}
|
||||
}
|
||||
|
||||
# docs/semver-policy.md (CultLib root, two levels up from this script): refuse a release whose version
|
||||
# does not tell the truth. The check measures the freshly built CultMath.dll's public API against the
|
||||
# DLL the previous cultmath-unity tag tracked (read from git), so it runs once the build exists.
|
||||
# cultmath is pre-1.0 (0.y.z): a break must be at least a minor bump. $repoRoot above is this package's
|
||||
# own root (packages\cultmath), not CultLib's; the shared checker script lives one level above that.
|
||||
$cultLibRoot = Split-Path -Parent (Split-Path -Parent $repoRoot)
|
||||
$cultmathVersion = (Get-Content -LiteralPath (Join-Path $templateRoot "package.json") -Raw | ConvertFrom-Json).version
|
||||
& node (Join-Path $cultLibRoot "scripts\check-changelog-semver.mjs") `
|
||||
--package "org.gamecult.cultmath" `
|
||||
--changelog (Join-Path $templateRoot "CHANGELOG.md") `
|
||||
--version $cultmathVersion `
|
||||
--tag-prefix "cultmath-unity" `
|
||||
--cwd $cultLibRoot `
|
||||
--api-baseline-path "packages/cultmath/unity/org.gamecult.cultmath/Runtime/Plugins" `
|
||||
--api-built $freshAssembly
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "CultMath Unity package failed the semver policy check (see docs/semver-policy.md)."
|
||||
}
|
||||
|
||||
$requiredTemplateFiles = @(
|
||||
"LICENSE.md",
|
||||
"LICENSE.md.meta",
|
||||
|
|
|
|||
|
|
@ -39,21 +39,6 @@ if (Test-Path -LiteralPath $outputRoot) {
|
|||
|
||||
$unityPackageVersion = (Get-Content -LiteralPath (Join-Path $templateRoot "package.json") -Raw | ConvertFrom-Json).version
|
||||
|
||||
# docs/semver-policy.md: refuse to build a release whose CHANGELOG.md entry
|
||||
# claims a breaking change under too small a bump, or whose version skips or
|
||||
# reverses the previous published tag. Runs before the (slow) build below so
|
||||
# a bad version number fails fast.
|
||||
& node (Join-Path $repoRoot "scripts\check-changelog-semver.mjs") `
|
||||
--package "org.gamecult.cultlib" `
|
||||
--changelog (Join-Path $templateRoot "CHANGELOG.md") `
|
||||
--version $unityPackageVersion `
|
||||
--tag-prefix "cultlib-unity" `
|
||||
--cwd $repoRoot
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "CultLib Unity package failed the semver policy check (see docs/semver-policy.md)."
|
||||
}
|
||||
|
||||
|
||||
# Release gate: cultlib's Unity package resolves CultMath through the org.gamecult.cultmath
|
||||
# dependency, so a cultlib release must not run ahead of the CultMath package it names.
|
||||
# (1) The declared dependency version must not exceed the CultMath package's own version.
|
||||
|
|
@ -187,6 +172,30 @@ foreach ($assemblyName in $expectedAssemblies) {
|
|||
}
|
||||
}
|
||||
|
||||
# docs/semver-policy.md: refuse a release whose version does not tell the truth. The check measures
|
||||
# the public API of every shipped GameCult.* assembly against the DLLs the previous cultlib-unity tag
|
||||
# tracked (read from git), so it runs here, once the assemblies under judgement exist.
|
||||
$measuredArguments = @()
|
||||
foreach ($assemblyName in $expectedAssemblies) {
|
||||
if ($assemblyName.StartsWith("GameCult.")) {
|
||||
$measuredArguments += @("--api-built", $publishedByName[$assemblyName].FullName)
|
||||
}
|
||||
}
|
||||
foreach ($refRoot in @($publishRoot, $quicPublishRoot, $webSocketPublishRoot)) {
|
||||
$measuredArguments += @("--api-refs", $refRoot)
|
||||
}
|
||||
& node (Join-Path $repoRoot "scripts\check-changelog-semver.mjs") `
|
||||
--package "org.gamecult.cultlib" `
|
||||
--changelog (Join-Path $templateRoot "CHANGELOG.md") `
|
||||
--version $unityPackageVersion `
|
||||
--tag-prefix "cultlib-unity" `
|
||||
--cwd $repoRoot `
|
||||
--api-baseline-path "unity/org.gamecult.cultlib/Runtime/Plugins" `
|
||||
@measuredArguments
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "CultLib Unity package failed the semver policy check (see docs/semver-policy.md)."
|
||||
}
|
||||
|
||||
Copy-Item -LiteralPath (Join-Path $templateRoot "Runtime\GameCult.CultLib.asmdef") `
|
||||
-Destination (Join-Path $outputRoot "Runtime")
|
||||
foreach ($assemblyName in $expectedAssemblies) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue