DotNet.AutoNormalize follows release principles consistent with premier open-source libraries:
- Zero Secret Exposure: Build and pull-request workflows run with read-only permissions and zero access to publishing credentials.
- Deterministic & Reproducible Builds: Packages are built with
<Deterministic>true</Deterministic>and-p:ContinuousIntegrationBuild=true, ensuring identical binary artifacts regardless of build environment. - Multi-Stage Validation: Every release candidate passes through compilation, unit tests, public API approval tests, sample execution, package artifact inspection, and independent package consumer validation before any publication gate.
- Protected Environment Approval: Publishing to NuGet.org is gated behind GitHub Environment protection rules requiring explicit maintainer review.
flowchart TD
Tag["Git Tag (v1.0.0-*) / Manual Dispatch"] --> Validate["Validate SemVer & Dependencies"]
Validate --> Build["Deterministic Build (-c Release)"]
Build --> Test["Run 74 Solution Tests (incl. PublicApi)"]
Test --> Pack["Pack 5 .nupkg + 5 .snupkg"]
Pack --> Inspect["Inspect Zip Assets (XML docs, PDBs)"]
Inspect --> Consumer["Downstream Consumer Validation (3 Tests)"]
Consumer --> Checksum["Generate SHA-256 Checksums"]
Checksum --> UploadArtifacts["Upload Workflow Artifacts"]
UploadArtifacts --> EnvGate{"Manual Review Gate\n(nuget-release environment)"}
EnvGate -->|Approved| PushNuGet["Push to NuGet.org (OIDC / Protected Secret)"]
EnvGate -->|Dry Run / Rejected| Halt["Halt without Publishing"]
UploadArtifacts --> GHRelease["Create GitHub Release (Draft/Pre-release)"]
All GitHub Actions in .github/workflows/release.yml and .github/workflows/docs.yml are pinned to immutable, full-length commit SHAs with semantic version comments. This prevents automated supply-chain compromise via mutable tag reassignment.
The pipeline executes:
dotnet list package --vulnerable --include-transitiveThis fails the release job if any dependency or transitive dependency contains a known CVE in the GitHub Advisory Database.
- Workflow default permissions are set to
permissions: contents: read. - Elevated write permissions (
contents: writeorpages: write) are scoped strictly to individual jobs that require them (publish-github-releaseanddeploy-docs).
Every build computes and publishes checksums.sha256 containing SHA-256 digests of all generated .nupkg and .snupkg files.
DotNet.AutoNormalize supports NuGet Trusted Publishing, eliminating long-lived static API keys in favor of short-lived OpenID Connect tokens exchanged directly between GitHub Actions and NuGet.org.
- Log into nuget.org.
- Go to Account Settings (or Organization Settings for
SkyDevLab) → Trusted Publishing. - Click Add a new trusted publisher:
- Policy Name:
DotNet-AutoNormalize-Release - Repository Owner:
SkyDevLab - Repository Name:
DotNet.AutoNormalize - Workflow Name:
release.yml - Environment:
nuget-release(recommended for manual approval gating).
- Policy Name:
- Save the policy.
- The
release.ymlworkflow requests an OIDC token (permissions: id-token: write). - The
NuGet/login@v1action presents the GitHub identity token to NuGet.org. - NuGet.org validates that the workflow is running in
SkyDevLab/DotNet.AutoNormalizeunder thenuget-releaseenvironment, and returns a short-lived, 15-minute publishing token. - Packages are published with zero persistent secrets stored in GitHub.
If Trusted Publishing is not yet configured on the NuGet.org account, the workflow automatically falls back to:
- Secret
NUGET_API_KEYstored within the protectednuget-releaseGitHub Environment. - Gated behind manual maintainer approval in GitHub repository settings.
- Standard branch builds and pull requests have zero access to the secret.
The documentation pipeline runs independently from package release:
- Triggers on documentation changes (
docs/**,README.md) onmain. - Verifies internal file links and structure.
- Builds static content for GitHub Pages and deploys via
actions/deploy-pages.