Releasing¶
This repository has a guarded release workflow at .github/workflows/release.yml.
Prerequisites¶
- Create a NuGet.org Trusted Publishing policy for this repository:
- Repository owner:
georgepwall1991 - Repository:
HttpClient.Resilience.Analyzers - Workflow file:
release.yml - Environment: leave empty unless the workflow is changed to use a GitHub Actions environment.
- Set a repository variable named
NUGET_USERto the NuGet.org profile name that owns the trusted publishing policy. Use the profile name, not an email address. - Keep the package version in
src/HttpClient.Resilience.Analyzers.Package/HttpClient.Resilience.Analyzers.Package.csprojaligned with the intended NuGet version. The scanner package reads that same version, so both packages always ship together. - Run the local validation stack before tagging:
dotnet restore HttpClient.Resilience.Analyzers.slnx
dotnet format HttpClient.Resilience.Analyzers.slnx --verify-no-changes --exclude samples
dotnet build HttpClient.Resilience.Analyzers.slnx --configuration Release --no-restore
./scripts/Validate-Repository.ps1
./scripts/Validate-SampleDiagnostics.ps1 -NoRestore
dotnet test HttpClient.Resilience.Analyzers.slnx --configuration Release --no-build --logger trx --results-directory artifacts\test-results
dotnet pack src\HttpClient.Resilience.Analyzers.Package\HttpClient.Resilience.Analyzers.Package.csproj --configuration Release --no-build --output artifacts\packages
dotnet pack src\HttpClient.Resilience.Analyzers.Scan\HttpClient.Resilience.Analyzers.Scan.csproj --configuration Release --no-build --output artifacts\packages
$version = ([xml](Get-Content src\HttpClient.Resilience.Analyzers.Package\HttpClient.Resilience.Analyzers.Package.csproj)).Project.PropertyGroup.Version
$analyzerPackage = Join-Path $PWD "artifacts/packages/HttpClient.Resilience.Analyzers.$version.nupkg"
$scannerPackage = Join-Path $PWD "artifacts/packages/HttpClient.Resilience.Analyzers.Scan.$version.nupkg"
./scripts/Validate-Package.ps1 -PackagePath $analyzerPackage
./scripts/Validate-PackageConsumption.ps1 -PackagePath $analyzerPackage
./scripts/Validate-ScannerPackage.ps1 -PackagePath $scannerPackage
./scripts/Validate-ScannerConsumption.ps1 -PackagePath $scannerPackage
Use the explicit package paths shown above rather than Get-ChildItem *.nupkg; the release now
produces both the analyzer package and the scanner tool, and wildcard selection can validate or
publish the wrong one.
When analyzer behavior changed since the last release, also run the scan regression gate and review any baseline diff before tagging:
The tag workflow does not run it because the gate needs network access, package restores, and a large clone cache. See Scan regression corpus for the corpus and baseline policy.
CI and release workflows also pass -ExpectedRepositoryCommit so each package's repository commit
metadata must match the exact checked-out Git SHA before publishing. Tag-triggered releases run
Validate-ReleaseVersion.ps1 and stop before building when the tag does not exactly match the
package version.
Stable Release¶
After merging the release commit to main, read the stable package version and create a matching v<package-version> tag on that exact merge commit:
[xml]$project = Get-Content src\HttpClient.Resilience.Analyzers.Package\HttpClient.Resilience.Analyzers.Package.csproj
$version = $project.Project.PropertyGroup.Version
git tag -a "v$version" (git rev-parse origin/main) -m "Release v$version"
git push origin "v$version"
The release workflow will restore, format-check, build, test, pack both packages, validate each package and its consumption path, upload artifacts, push both .nupkg files to NuGet.org, and create a matching GitHub Release with generated release notes and both packages attached.
Publishing uses NuGet Trusted Publishing through GitHub OIDC and NuGet/login@v1; no long-lived NuGet API key is stored in the repository.
Dry Run¶
Use the Release workflow's workflow_dispatch trigger with publish set to false. This executes the full build, test, pack, validation, and artifact upload path without publishing.
Manual Publish¶
Use workflow_dispatch with publish set to true only when publishing from the current branch is intentional. Tag-based releases are preferred because they leave an immutable version marker.