From be61d36a9a857d1c55845028f72a43da2e2697d5 Mon Sep 17 00:00:00 2001 From: "Kevin D. Wolf" Date: Sat, 29 Aug 2026 14:32:15 -0400 Subject: [PATCH 1/4] Emit package catalog from Core build --- Build-GitHubPackages.ps1 | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/Build-GitHubPackages.ps1 b/Build-GitHubPackages.ps1 index 05686bc5..6efb6293 100644 --- a/Build-GitHubPackages.ps1 +++ b/Build-GitHubPackages.ps1 @@ -3,7 +3,10 @@ param( [string]$Version = '5.0.0', [Parameter(Mandatory = $false)] - [string]$OutputDirectory = './artifacts/packages' + [string]$OutputDirectory = './artifacts/packages', + + [Parameter(Mandatory = $false)] + [string]$CatalogPath = './artifacts/package-catalog.json' ) $ErrorActionPreference = 'Stop' @@ -15,6 +18,7 @@ Set-Location $repoRoot $projectPath = Join-Path $repoRoot 'src/LagoVista.Core/LagoVista.Core.csproj' $nuspecPath = Join-Path $repoRoot 'src/LagoVista.Core/Package.nuspec' $outputPath = [System.IO.Path]::GetFullPath((Join-Path $repoRoot $OutputDirectory)) +$catalogFullPath = [System.IO.Path]::GetFullPath((Join-Path $repoRoot $CatalogPath)) if (-not (Test-Path $projectPath)) { throw "Project not found: $projectPath" } if (-not (Test-Path $nuspecPath)) { throw "NuSpec not found: $nuspecPath" } @@ -23,6 +27,7 @@ if (Test-Path $outputPath) { Remove-Item -Recurse -Force $outputPath } New-Item -ItemType Directory -Force -Path $outputPath | Out-Null +New-Item -ItemType Directory -Force -Path (Split-Path $catalogFullPath -Parent) | Out-Null Write-Host "Building LagoVista.Core package $Version" Write-Host "Output: $outputPath" @@ -45,7 +50,7 @@ if ($internalDependencies.Count -gt 0) { throw "LagoVista.Core canary must not have internal LagoVista dependencies. Found: $names" } -# Stamp only the CI checkout. The committed NuSpec remains historical source metadata. +# Stamp only the build checkout. The committed NuSpec remains historical source metadata. $metadata.version = $Version $settings = New-Object System.Xml.XmlWriterSettings $settings.Indent = $true @@ -80,4 +85,30 @@ if (-not (Test-Path $packagePath)) { throw "Expected package was not produced: $packagePath" } +$sourceRepository = if ($env:GITHUB_REPOSITORY) { $env:GITHUB_REPOSITORY } else { 'LagoVista/Core' } +$sourceCommit = if ($env:GITHUB_SHA) { $env:GITHUB_SHA } else { (git rev-parse HEAD).Trim() } +$sourceRef = if ($env:GITHUB_REF_NAME) { $env:GITHUB_REF_NAME } else { (git branch --show-current).Trim() } + +$catalog = [ordered]@{ + schemaVersion = 1 + generatedUtc = [DateTime]::UtcNow.ToString('o') + source = [ordered]@{ + repository = $sourceRepository + commit = $sourceCommit + ref = $sourceRef + } + packages = @( + [ordered]@{ + id = 'LagoVista.Core' + version = $Version + file = [System.IO.Path]::GetFileName($packagePath) + targetFrameworks = @('netstandard2.0') + internalDependencies = @() + } + ) +} + +$catalog | ConvertTo-Json -Depth 8 | Set-Content -Path $catalogFullPath -Encoding utf8 + Write-Host "Created $packagePath" +Write-Host "Created $catalogFullPath" From df8b67d654faa60842c6dbb378d5a87090af07b7 Mon Sep 17 00:00:00 2001 From: "Kevin D. Wolf" Date: Sat, 29 Aug 2026 14:32:41 -0400 Subject: [PATCH 2/4] Add repo-owned package build workflow --- .github/workflows/go-compile-yourself.yml | 88 +++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 .github/workflows/go-compile-yourself.yml diff --git a/.github/workflows/go-compile-yourself.yml b/.github/workflows/go-compile-yourself.yml new file mode 100644 index 00000000..444b5073 --- /dev/null +++ b/.github/workflows/go-compile-yourself.yml @@ -0,0 +1,88 @@ +name: Go Compile Yourself + +on: + push: + branches: + - 'feature/**' + pull_request: + branches: + - master + workflow_dispatch: + inputs: + version: + description: Package version to build + required: true + type: string + default: 5.0.0 + publish: + description: Publish the package to the shared GitHub Packages feed + required: true + type: boolean + default: false + +permissions: + contents: read + +jobs: + build-package: + runs-on: windows-latest + timeout-minutes: 30 + + env: + PACKAGE_VERSION: ${{ github.event_name == 'workflow_dispatch' && inputs.version || format('5.0.0-feature.{0}', github.run_number) }} + PACKAGE_SOURCE: https://nuget.pkg.github.com/nuviot/index.json + NUGET_GITHUB_TOKEN: ${{ secrets.NUGET_GITHUB_TOKEN }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup .NET 9 + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 9.0.x + + - name: Setup NuGet + uses: NuGet/setup-nuget@v2 + + - name: Configure shared package feed + if: ${{ env.NUGET_GITHUB_TOKEN != '' }} + shell: pwsh + run: | + dotnet nuget remove source nuviot 2>$null + dotnet nuget add source "$env:PACKAGE_SOURCE" ` + --name nuviot ` + --username "${{ github.actor }}" ` + --password "$env:NUGET_GITHUB_TOKEN" ` + --store-password-in-clear-text + + - name: Build, test, and pack repository packages + shell: pwsh + run: ./Build-GitHubPackages.ps1 -Version $env:PACKAGE_VERSION + + - name: Upload package build + uses: actions/upload-artifact@v4 + with: + name: LagoVista.Core-${{ env.PACKAGE_VERSION }} + path: | + artifacts/packages/LagoVista.Core.${{ env.PACKAGE_VERSION }}.nupkg + artifacts/package-catalog.json + if-no-files-found: error + + - name: Publish package + if: ${{ github.event_name == 'workflow_dispatch' && inputs.publish }} + shell: pwsh + run: | + if ([string]::IsNullOrWhiteSpace($env:NUGET_GITHUB_TOKEN)) { + throw 'NUGET_GITHUB_TOKEN is required when publish=true.' + } + + $package = "artifacts/packages/LagoVista.Core.$env:PACKAGE_VERSION.nupkg" + dotnet nuget push $package ` + --source nuviot ` + --api-key "$env:NUGET_GITHUB_TOKEN" ` + --skip-duplicate + + if ($LASTEXITCODE -ne 0) { + throw "Failed to publish '$package'." + } From 10e92ac7874d7392c6a566c527d7e325eaddb188 Mon Sep 17 00:00:00 2001 From: "Kevin D. Wolf" Date: Sat, 29 Aug 2026 14:32:46 -0400 Subject: [PATCH 3/4] Replace bootstrap workflow with repo-owned package build --- .../workflows/github-packages-baseline.yml | 86 ------------------- 1 file changed, 86 deletions(-) delete mode 100644 .github/workflows/github-packages-baseline.yml diff --git a/.github/workflows/github-packages-baseline.yml b/.github/workflows/github-packages-baseline.yml deleted file mode 100644 index 2812ca79..00000000 --- a/.github/workflows/github-packages-baseline.yml +++ /dev/null @@ -1,86 +0,0 @@ -name: LagoVista.Core Package Canary - -on: - pull_request: - branches: - - master - push: - branches: - - master - workflow_dispatch: - inputs: - publish: - description: Publish LagoVista.Core to GitHub Packages - required: true - type: boolean - default: false - version: - description: LagoVista.Core semantic version - required: true - type: string - default: 5.0.0 - -permissions: - contents: read - -jobs: - build-pack: - runs-on: windows-latest - timeout-minutes: 30 - - env: - PACKAGE_VERSION: ${{ github.event_name == 'workflow_dispatch' && inputs.version || '5.0.0' }} - PACKAGE_SOURCE: https://nuget.pkg.github.com/nuviot/index.json - NUGET_GITHUB_TOKEN: ${{ secrets.NUGET_GITHUB_TOKEN }} - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup .NET 9 - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 9.0.x - - - name: Setup NuGet - uses: NuGet/setup-nuget@v2 - - - name: Add GitHub Packages source - if: ${{ env.NUGET_GITHUB_TOKEN != '' }} - shell: pwsh - run: | - dotnet nuget remove source github 2>$null - dotnet nuget add source "$env:PACKAGE_SOURCE" ` - --name github ` - --username "${{ github.actor }}" ` - --password "$env:NUGET_GITHUB_TOKEN" ` - --store-password-in-clear-text - - - name: Build and pack LagoVista.Core - shell: pwsh - run: ./Build-GitHubPackages.ps1 -Version $env:PACKAGE_VERSION - - - name: Upload package artifact - uses: actions/upload-artifact@v4 - with: - name: LagoVista.Core-${{ env.PACKAGE_VERSION }} - path: artifacts/packages/LagoVista.Core.${{ env.PACKAGE_VERSION }}.nupkg - if-no-files-found: error - - - name: Publish to GitHub Packages - if: ${{ github.event_name == 'workflow_dispatch' && inputs.publish }} - shell: pwsh - run: | - if ([string]::IsNullOrWhiteSpace($env:NUGET_GITHUB_TOKEN)) { - throw 'NUGET_GITHUB_TOKEN is required when publish=true.' - } - - $package = "artifacts/packages/LagoVista.Core.$env:PACKAGE_VERSION.nupkg" - dotnet nuget push $package ` - --source github ` - --api-key "$env:NUGET_GITHUB_TOKEN" ` - --skip-duplicate - - if ($LASTEXITCODE -ne 0) { - throw "Failed to publish '$package'." - } From f54384af88b29f2beab182c039aa56280912e113 Mon Sep 17 00:00:00 2001 From: "Kevin D. Wolf" Date: Sat, 29 Aug 2026 14:34:44 -0400 Subject: [PATCH 4/4] Clarify package build workflow label --- .github/workflows/go-compile-yourself.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go-compile-yourself.yml b/.github/workflows/go-compile-yourself.yml index 444b5073..1d46eee3 100644 --- a/.github/workflows/go-compile-yourself.yml +++ b/.github/workflows/go-compile-yourself.yml @@ -56,7 +56,7 @@ jobs: --password "$env:NUGET_GITHUB_TOKEN" ` --store-password-in-clear-text - - name: Build, test, and pack repository packages + - name: Build and pack repository packages shell: pwsh run: ./Build-GitHubPackages.ps1 -Version $env:PACKAGE_VERSION