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. - 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
$package = Get-ChildItem artifacts\packages\*.nupkg | Sort-Object LastWriteTime -Descending | Select-Object -First 1
./scripts/Validate-Package.ps1 -PackagePath $package.FullName
./scripts/Validate-PackageConsumption.ps1 -PackagePath $package.FullName
CI and release workflows also pass -ExpectedRepositoryCommit so the 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, validate the package, upload artifacts, push the .nupkg to NuGet.org, and create a matching GitHub Release with generated release notes and the package 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.