From be9fcd03771ccd535d052d4f48ccd197797ebc68 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Feb 2026 20:41:39 +0000 Subject: [PATCH 1/4] Initial plan From 55050bf2dcd6b0a4f207786b946cab2ac991701c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Feb 2026 20:44:12 +0000 Subject: [PATCH 2/4] Implement automatic version incrementing based on GitHub run number Co-authored-by: scott-wi <7329487+scott-wi@users.noreply.github.com> --- .github/workflows/build-and-publish.yml | 26 +++++++++++-- src/build.ps1 | 50 +++++++++++++++---------- 2 files changed, 54 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index 716ca54..78b4471 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -99,7 +99,9 @@ jobs: if: github.event_name == 'push' || github.event_name == 'release' || github.event_name == 'workflow_dispatch' run: | cd src - .\build.ps1 -Configuration Release -PackOnly -PackageOutputPath "${{ github.workspace }}/packages" + $version = "1.0.${{ github.run_number }}" + Write-Host "Creating packages with version: $version" + .\build.ps1 -Configuration Release -PackOnly -PackageOutputPath "${{ github.workspace }}/packages" -Version $version shell: pwsh - name: Upload NuGet packages @@ -133,9 +135,18 @@ jobs: - name: Publish to GitHub Packages run: | + $hasError = $false Get-ChildItem -Path packages -Filter *.nupkg -Recurse | ForEach-Object { Write-Host "Publishing $($_.Name)..." - dotnet nuget push $_.FullName --api-key ${{ secrets.GITHUB_TOKEN }} --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" --skip-duplicate + dotnet nuget push $_.FullName --api-key ${{ secrets.GITHUB_TOKEN }} --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" + if ($LASTEXITCODE -ne 0) { + $hasError = $true + Write-Error "Failed to publish $($_.Name)" + } + } + if ($hasError) { + Write-Error "One or more packages failed to publish. This may indicate duplicate versions." + exit 1 } shell: pwsh @@ -173,9 +184,18 @@ jobs: - name: Publish to GitHub Packages run: | + $hasError = $false Get-ChildItem -Path packages -Filter *.nupkg -Recurse | ForEach-Object { Write-Host "Publishing release package $($_.Name)..." - dotnet nuget push $_.FullName --api-key ${{ secrets.GITHUB_TOKEN }} --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" --skip-duplicate + dotnet nuget push $_.FullName --api-key ${{ secrets.GITHUB_TOKEN }} --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" + if ($LASTEXITCODE -ne 0) { + $hasError = $true + Write-Error "Failed to publish $($_.Name)" + } + } + if ($hasError) { + Write-Error "One or more packages failed to publish. This may indicate duplicate versions." + exit 1 } shell: pwsh env: diff --git a/src/build.ps1 b/src/build.ps1 index 6d9e7a2..1b7856f 100644 --- a/src/build.ps1 +++ b/src/build.ps1 @@ -14,6 +14,8 @@ Create NuGet packages for library projects .PARAMETER PackageOutputPath Output directory for NuGet packages. Default: ./artifacts/packages +.PARAMETER Version + Version number for NuGet packages. If not specified, uses version from .csproj files .PARAMETER VerboseOutput Enable verbose output .PARAMETER EnableCodeCoverage @@ -34,6 +36,8 @@ .\build.ps1 -Pack .EXAMPLE .\build.ps1 -Pack -PackageOutputPath "C:\packages" +.EXAMPLE + .\build.ps1 -Pack -Version "1.0.5" .EXAMPLE .\build.ps1 -EnableCodeCoverage -GenerateTestReport .EXAMPLE @@ -53,6 +57,8 @@ param( [string]$PackageOutputPath, + [string]$Version, + [switch]$VerboseOutput, [switch]$EnableCodeCoverage, @@ -471,25 +477,31 @@ function Invoke-Pack { $packagesCreated = 0 foreach ($project in $packProjects) { - $projectPath = Join-Path $scriptPath $project - if (Test-Path $projectPath) { - Write-Info "Packing $(Split-Path $project -Leaf)" - - $packArgs = @( - "pack" - $projectPath - "--configuration", $Configuration - "--no-build" - "--no-restore" - "--output", $PackageOutputPath - "--verbosity", $verbosityLevel - ) - - # Add include symbols option for Release builds - if ($Configuration -eq "Release") { - $packArgs += "--include-symbols" - $packArgs += "--include-source" - } + $projectPath = Join-Path $scriptPath $project + if (Test-Path $projectPath) { + Write-Info "Packing $(Split-Path $project -Leaf)" + + $packArgs = @( + "pack" + $projectPath + "--configuration", $Configuration + "--no-build" + "--no-restore" + "--output", $PackageOutputPath + "--verbosity", $verbosityLevel + ) + + # Add version if specified + if ($Version) { + $packArgs += "-p:Version=$Version" + Write-Info "Using version: $Version" + } + + # Add include symbols option for Release builds + if ($Configuration -eq "Release") { + $packArgs += "--include-symbols" + $packArgs += "--include-source" + } dotnet @packArgs From c16c74797ecfae49813516879d05d1749168d9ce Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Feb 2026 20:46:22 +0000 Subject: [PATCH 3/4] Update documentation for automatic version incrementing Co-authored-by: scott-wi <7329487+scott-wi@users.noreply.github.com> --- .github/workflows/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 65042c3..0c37005 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -69,6 +69,13 @@ Publishes NuGet packages to GitHub Package Registry. https://nuget.pkg.github.com/ClearMeasureLabs/index.json ``` +**Version Management:** +- Package versions are automatically incremented using the format `1.0.{run_number}` +- The `run_number` is provided by GitHub Actions and increments with each workflow run +- This ensures each push to main creates unique package versions +- If a duplicate version is detected, the workflow will fail with an error +- The `--skip-duplicate` flag is NOT used to ensure version conflicts are caught early + ##### 3. Publish Release to GitHub Packages Publishes release packages and attaches them to the GitHub release. @@ -98,6 +105,7 @@ The workflows leverage the `src/build.ps1` PowerShell script for all build opera | `-Pack` | Create NuGet packages | ✅ Yes (pack step) | | `-PackOnly` | Only create packages | ✅ Yes (pack step) | | `-PackageOutputPath` | Package output directory | ✅ Yes (custom path) | +| `-Version` | Version number for packages | ✅ Yes (1.0.{run_number}) | | `-Clean` | Clean before build | ❌ No (fresh checkout) | | `-VerboseOutput` | Verbose MSBuild output | ❌ No (uses defaults) | From fac3fd932d71dabfa84c5d34413b4506c4ecc981 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Feb 2026 20:59:24 +0000 Subject: [PATCH 4/4] Add default version 0.0.999 for local builds Addresses PR review comment from scott-wi to make local development easier by providing a default version when -Version parameter is not specified. CI/CD workflows will continue to pass explicit versions. Co-authored-by: scott-wi <7329487+scott-wi@users.noreply.github.com> --- src/build.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/build.ps1 b/src/build.ps1 index 1b7856f..9cf316b 100644 --- a/src/build.ps1 +++ b/src/build.ps1 @@ -15,7 +15,7 @@ .PARAMETER PackageOutputPath Output directory for NuGet packages. Default: ./artifacts/packages .PARAMETER Version - Version number for NuGet packages. If not specified, uses version from .csproj files + Version number for NuGet packages. Default: 0.0.999 for local builds .PARAMETER VerboseOutput Enable verbose output .PARAMETER EnableCodeCoverage @@ -57,7 +57,7 @@ param( [string]$PackageOutputPath, - [string]$Version, + [string]$Version = "0.0.999", [switch]$VerboseOutput,