Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ permissions:
jobs:
repository:
runs-on: ubuntu-latest
outputs:
plugins: ${{ steps.registry.outputs.plugins }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
Expand All @@ -24,15 +26,21 @@ jobs:
./eng/Test-ReleaseDestinations.ps1
./eng/Test-NuGetPublication.ps1
./eng/Test-GitHubPackages.ps1
- name: Validate Quake core safety tests
run: dotnet test plugins/Server.Quake3/LANCommander.Community.Server.Quake3.Tests/LANCommander.Community.Server.Quake3.Tests.csproj -c Release --nologo
- name: Select registered components
id: registry
shell: pwsh
run: |
Import-Module ./eng/PluginRelease.psm1 -Force
$plugins = ConvertTo-Json -InputObject @(Get-PluginRegistry | ForEach-Object key) -Compress
"plugins=$plugins" >> $env:GITHUB_OUTPUT

validate:
needs: repository
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
plugin: [Server.Mcp, Server.RecompCatalog, Launcher.MQTT, Server.Quake3]
plugin: ${{ fromJSON(needs.repository.outputs.plugins) }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
Expand Down
67 changes: 3 additions & 64 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ name: Component release
on:
push:
tags:
- server-mcp-v*
- server-recompcatalog-v*
- launcher-mqtt-v*
- server-quake3-v*
- '*-v*'
workflow_dispatch:
inputs:
tag:
Expand Down Expand Up @@ -92,74 +89,16 @@ jobs:
"artifact_run_id=$env:ARTIFACT_RUN_ID" >> $env:GITHUB_OUTPUT
"artifact_run_attempt=$env:ARTIFACT_RUN_ATTEMPT" >> $env:GITHUB_OUTPUT

server-mcp:
component-release:
needs: plan
if: needs.plan.outputs.plugin == 'Server.Mcp'
concurrency:
group: release-server-mcp
cancel-in-progress: false
permissions:
actions: read
contents: write
packages: write
uses: ./.github/workflows/release-plugin.yml
with:
plugin: Server.Mcp
tag: ${{ needs.plan.outputs.tag }}
artifact_run_id: ${{ needs.plan.outputs.artifact_run_id }}
artifact_run_attempt: ${{ needs.plan.outputs.artifact_run_attempt }}
secrets:
nuget_api_key: ${{ secrets.NUGET_API_KEY }}

server-quake3:
needs: plan
if: needs.plan.outputs.plugin == 'Server.Quake3'
permissions:
actions: read
contents: write
packages: write
uses: ./.github/workflows/release-plugin.yml
with:
plugin: Server.Quake3
tag: ${{ needs.plan.outputs.tag }}
artifact_run_id: ${{ needs.plan.outputs.artifact_run_id }}
artifact_run_attempt: ${{ needs.plan.outputs.artifact_run_attempt }}
secrets:
nuget_api_key: ${{ secrets.NUGET_API_KEY }}

server-recompcatalog:
needs: plan
if: needs.plan.outputs.plugin == 'Server.RecompCatalog'
concurrency:
group: release-server-recompcatalog
cancel-in-progress: false
permissions:
actions: read
contents: write
packages: write
uses: ./.github/workflows/release-plugin.yml
with:
plugin: Server.RecompCatalog
tag: ${{ needs.plan.outputs.tag }}
artifact_run_id: ${{ needs.plan.outputs.artifact_run_id }}
artifact_run_attempt: ${{ needs.plan.outputs.artifact_run_attempt }}
secrets:
nuget_api_key: ${{ secrets.NUGET_API_KEY }}

launcher-mqtt:
needs: plan
if: needs.plan.outputs.plugin == 'Launcher.MQTT'
concurrency:
group: release-launcher-mqtt
cancel-in-progress: false
permissions:
actions: read
contents: write
# The caller grants the reusable workflow ceiling; child job permissions are scoped below.
packages: write
uses: ./.github/workflows/release-plugin.yml
with:
plugin: Launcher.MQTT
plugin: ${{ needs.plan.outputs.plugin }}
tag: ${{ needs.plan.outputs.tag }}
artifact_run_id: ${{ needs.plan.outputs.artifact_run_id }}
artifact_run_attempt: ${{ needs.plan.outputs.artifact_run_attempt }}
Expand Down
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ independent. Component-level props should contain only exceptions and import
the shared plugin props. Do not copy shared defaults into individual projects;
keep component-specific packaging and host runtime exclusions in their projects.

`eng/plugins.json` is the component allowlist used by build/validation scripts,
the CI matrix, and release selection. New components do not need a copied CI
matrix entry or release job. The generic component tag trigger still fails closed
on unknown prefixes, mismatched versions, and commits not reachable from `main`.

Before submitting changes, run the repository checks and the validation
command(s) for affected components from the root [README](README.md#build-and-validate).
See [Plugin releases](RELEASES.md) for versioning, packaging, and release
Expand Down
6 changes: 6 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ project and test paths, package identities, artifact formats, feed eligibility,
and host compatibility metadata. Keep it consistent with project/package
metadata when changing a component.

The tag workflow uses a generic `*-v*` trigger and resolves the exact component
through this registry before invoking one shared release job. Unknown tag
prefixes fail planning; they cannot publish. Per-component concurrency is
enforced by the reusable workflow. Release promotion, feed verification and
original-artifact recovery still use the same checked bytes without rebuilding.

| Component key | Version file | Changelog | Tag format | GitHub Release asset | NuGet feeds |
| --- | --- | --- | --- | --- | --- |
| `Server.Mcp` | `plugins/Server.Mcp/version.txt` | `plugins/Server.Mcp/CHANGELOG.md` | `server-mcp-v<version>` | `LANCommander.Community.Server.Mcp.<version>.nupkg` | GitHub Packages; NuGet.org if `NUGET_API_KEY` is set |
Expand Down
1 change: 0 additions & 1 deletion eng/Build-Plugin.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[CmdletBinding()]
param(
[Parameter(Mandatory)]
[ValidateSet('Server.Mcp', 'Server.RecompCatalog', 'Launcher.MQTT', 'Server.Quake3')]
[string] $Plugin,
[switch] $Package,
[string] $OutputDirectory
Expand Down
7 changes: 6 additions & 1 deletion eng/PluginRelease.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@ function Assert-PluginComponentIdentity {
function Get-PluginRegistry {
$path = Join-Path (Split-Path $PSScriptRoot -Parent) 'eng\plugins.json'
$registry = Get-Content -LiteralPath $path -Raw | ConvertFrom-Json
if ($registry.schemaVersion -ne 1 -or @($registry.plugins).Count -ne 4) {
if ($registry.schemaVersion -ne 1 -or @($registry.plugins).Count -eq 0) {
throw "Unsupported or incomplete plugin registry: $path"
}

$keys = @($registry.plugins | ForEach-Object key)
if (@($keys | Select-Object -Unique).Count -ne $keys.Count) {
throw 'Plugin registry contains duplicate keys.'
}
$prefixes = @($registry.plugins | ForEach-Object tagPrefix)
if (@($prefixes | Select-Object -Unique).Count -ne $prefixes.Count -or
@($prefixes | Where-Object { $_ -cnotmatch '^[a-z0-9]+(?:-[a-z0-9]+)*$' }).Count -gt 0) {
throw 'Plugin registry tag prefixes must be unique lowercase tag components.'
}
foreach ($plugin in $registry.plugins) {
Assert-PluginComponentIdentity $plugin
}
Expand Down
1 change: 0 additions & 1 deletion eng/Publish-GitHubPackage.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[CmdletBinding()]
param(
[Parameter(Mandatory)]
[ValidateSet('Server.Mcp', 'Server.RecompCatalog', 'Server.Quake3', 'Launcher.MQTT')]
[string] $Plugin,
[Parameter(Mandatory)][string] $Tag,
[Parameter(Mandatory)][string] $ArtifactDirectory,
Expand Down
1 change: 0 additions & 1 deletion eng/Publish-NuGetPackage.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[CmdletBinding()]
param(
[Parameter(Mandatory)]
[ValidateSet('Server.Mcp', 'Server.RecompCatalog', 'Server.Quake3', 'Launcher.MQTT')]
[string] $Plugin,
[Parameter(Mandatory)][string] $Tag,
[Parameter(Mandatory)][string] $ArtifactDirectory,
Expand Down
1 change: 0 additions & 1 deletion eng/Publish-Release.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[CmdletBinding()]
param(
[Parameter(Mandatory)]
[ValidateSet('Server.Mcp', 'Server.RecompCatalog', 'Launcher.MQTT', 'Server.Quake3')]
[string] $Plugin,
[Parameter(Mandatory)][string] $Tag,
[Parameter(Mandatory)][string] $ArtifactDirectory,
Expand Down
2 changes: 1 addition & 1 deletion eng/Test-NuGetPackage.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[CmdletBinding()]
param(
[Parameter(Mandatory)]
[ValidateSet('Server.Mcp', 'Server.RecompCatalog', 'Server.Quake3', 'Launcher.MQTT')]
[string] $Plugin,
[Parameter(Mandatory)][string] $PackagePath,
[Parameter(Mandatory)][string] $ExpectedVersion,
Expand All @@ -11,6 +10,7 @@ param(
$ErrorActionPreference = 'Stop'
Import-Module (Join-Path $PSScriptRoot 'PluginRelease.psm1') -Force
$component = @(Get-PluginRegistry | Where-Object key -CEQ $Plugin)[0]
if (-not $component) { throw "Unknown plugin '$Plugin'. Select only keys in eng/plugins.json." }
if ($component.artifactFormat -cne 'nupkg') {
throw "$Plugin does not produce a NuGet package."
}
Expand Down
15 changes: 9 additions & 6 deletions eng/Test-ReleaseDestinations.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ function Assert-Fails {

$releaseWorkflow = Get-Content -LiteralPath (Join-Path $repositoryRoot '.github/workflows/release-plugin.yml') -Raw
$callerWorkflow = Get-Content -LiteralPath (Join-Path $repositoryRoot '.github/workflows/release.yml') -Raw
$launcherJob = [regex]::Match($callerWorkflow, '(?ms)^ launcher-mqtt:\r?\n(?<body>.*?)(?=^ [A-Za-z0-9_-]+:|\z)').Groups['body'].Value
if ($launcherJob -notmatch 'packages:\s+write' -or
$launcherJob -notmatch 'nuget_api_key:\s+\$\{\{\s*secrets\.NUGET_API_KEY\s*\}\}' -or
$launcherJob -notmatch 'uses:\s+\./\.github/workflows/release-plugin\.yml') {
throw 'Launcher releases must use the shared workflow with package permissions and optional NuGet.org key forwarding.'
$componentJob = [regex]::Match($callerWorkflow, '(?ms)^ component-release:\r?\n(?<body>.*?)(?=^ [A-Za-z0-9_-]+:|\z)').Groups['body'].Value
if ($componentJob -notmatch 'needs:\s+plan' -or
$componentJob -notmatch 'plugin:\s+\$\{\{\s*needs\.plan\.outputs\.plugin\s*\}\}' -or
$componentJob -notmatch 'packages:\s+write' -or
$componentJob -notmatch 'nuget_api_key:\s+\$\{\{\s*secrets\.NUGET_API_KEY\s*\}\}' -or
$componentJob -notmatch 'uses:\s+\./\.github/workflows/release-plugin\.yml' -or
([regex]::Matches($callerWorkflow, 'uses:\s+\./\.github/workflows/release-plugin\.yml')).Count -ne 1 -or
$releaseWorkflow -notmatch 'group:\s+plugin-release-\$\{\{\s*inputs\.plugin\s*\}\}') {
throw 'All registered releases must use one plan-selected workflow with per-plugin concurrency, package permissions and optional NuGet.org key forwarding.'
}
$nugetKeyJob = [regex]::Match($releaseWorkflow, '(?ms)^ nuget-key:\r?\n(?<body>.*?)(?=^ [A-Za-z0-9_-]+:|\z)').Groups['body'].Value
$buildJob = [regex]::Match($releaseWorkflow, '(?ms)^ build:\r?\n(?<body>.*?)(?=^ [A-Za-z0-9_-]+:|\z)').Groups['body'].Value
Expand Down Expand Up @@ -53,7 +57,6 @@ if ($nugetJob -notmatch 'NUGET_API_KEY:\s+\$\{\{\s*secrets\.nuget_api_key\s*\}\}
throw 'NuGet.org must use the optional API key only in its package publishing job without an extra environment gate.'
}
if ($callerWorkflow -notmatch 'nuget_api_key:\s+\$\{\{\s*secrets\.NUGET_API_KEY\s*\}\}' -or
$callerWorkflow -notmatch 'server-quake3:' -or
$releaseWorkflow -match '(?s)publish-nuget-org:.*?NUGET_API_KEY.*?publish-github-packages:') {
throw 'The tag caller must pass the optional key to the reusable workflow without coupling the feeds.'
}
Expand Down
30 changes: 30 additions & 0 deletions eng/Test-ReleaseSelection.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,34 @@ Assert-Fails { Resolve-PluginSelection -Tag 'server-mcp-v0.2.1-beta.01' } 'Malfo
Assert-Fails { Resolve-PluginSelection -Plugins @('Server.RecompCatalog') -Tag 'server-mcp-v0.2.1' } 'Conflicting tag and selection'
Assert-Fails { Resolve-PluginSelection } 'Missing selection'

$fixtureRoot = Join-Path ([IO.Path]::GetTempPath()) "plugin-registry-$([Guid]::NewGuid().ToString('N'))"
New-Item -ItemType Directory -Path (Join-Path $fixtureRoot 'eng') | Out-Null
try {
$modulePath = Join-Path $fixtureRoot 'eng/RegistryFixture.psm1'
Copy-Item -LiteralPath (Join-Path $PSScriptRoot 'PluginRelease.psm1') -Destination $modulePath
Import-Module $modulePath -Prefix Fixture -Force
$registry = Get-Content -LiteralPath (Join-Path $PSScriptRoot 'plugins.json') -Raw | ConvertFrom-Json
$extra = $registry.plugins[0] | ConvertTo-Json -Depth 5 | ConvertFrom-Json
$extra.key = 'Server.Example'
$extra.tagPrefix = 'server-example'
$extra.project = 'plugins/Server.Example/LANCommander.Community.Server.Example/LANCommander.Community.Server.Example.csproj'
$extra.packageId = $extra.assemblyName = $extra.rootNamespace = 'LANCommander.Community.Server.Example'
$registry.plugins += $extra
$registry | ConvertTo-Json -Depth 5 | Set-Content (Join-Path $fixtureRoot 'eng/plugins.json')
Assert-Equal 5 @(Get-FixturePluginRegistry).Count 'Registry accepts a new canonical component without editing an allowlist'
$extra.tagPrefix = $registry.plugins[0].tagPrefix
$registry | ConvertTo-Json -Depth 5 | Set-Content (Join-Path $fixtureRoot 'eng/plugins.json')
Assert-Fails { Get-FixturePluginRegistry } 'Registry rejects ambiguous tag prefixes'
}
finally {
Remove-Module RegistryFixture -ErrorAction SilentlyContinue
Remove-Item -LiteralPath $fixtureRoot -Recurse -Force
}

Assert-Fails { & (Join-Path $PSScriptRoot 'Build-Plugin.ps1') -Plugin Server.Unknown } 'Build rejects unknown registry key'
Assert-Fails { & (Join-Path $PSScriptRoot 'Validate-Plugin.ps1') -Plugin Server.Unknown } 'Validation rejects unknown registry key'
Assert-Fails {
& (Join-Path $PSScriptRoot 'Test-NuGetPackage.ps1') -Plugin Server.Unknown -PackagePath missing.nupkg -ExpectedVersion 1.0.0
} 'Package validation rejects unknown registry key'

Write-Output 'Release selection tests passed.'
7 changes: 3 additions & 4 deletions eng/Validate-Plugin.ps1
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
[CmdletBinding()]
param(
[Parameter(Mandatory)]
[ValidateSet('Server.Mcp', 'Server.RecompCatalog', 'Launcher.MQTT', 'Server.Quake3')]
[string] $Plugin,
[string] $OutputDirectory
)

$ErrorActionPreference = 'Stop'
$repositoryRoot = Split-Path $PSScriptRoot -Parent
$component = @(Get-Content -LiteralPath (Join-Path $PSScriptRoot 'plugins.json') -Raw |
ConvertFrom-Json | Select-Object -ExpandProperty plugins | Where-Object key -CEQ $Plugin)[0]
if (-not $component) { throw "Plugin '$Plugin' is missing from the release registry." }
Import-Module (Join-Path $PSScriptRoot 'PluginRelease.psm1') -Force
$null = Resolve-PluginSelection -Plugins @($Plugin)
$component = @(Get-PluginRegistry | Where-Object key -CEQ $Plugin)[0]
$testProjects = @($component.tests | ForEach-Object { Join-Path $repositoryRoot $_ })
$packageOutput = if ($OutputDirectory) { $OutputDirectory } else {
Join-Path $repositoryRoot "artifacts/validation-$($component.tagPrefix)"
Expand Down
Loading