Repository CI/CD
This repository dogfoods the shared Purview.Build tool: it builds and packs the tool from source, installs the generated package, then runs purview-build against itself so the project builds and packs itself.
CI (ci.yml)
Section titled “CI (ci.yml)”Runs on pull requests and pushes to main:
- Check out the repository.
- Set up .NET and Bun.
- Configure NuGet sources with the shared
./actions/nuget-sourcesaction, which is the same implementation the reusable workflows use. It registers nuget.org and the organisation GitHub Packages feed for the job. The workflow declarespackages: read, andGITHUB_TOKENis job-level so the%GITHUB_TOKEN%credential can be resolved. - Restore
src/Build.slnx. - Build gate:
dotnet build src/Build.slnx --configuration Release --no-restore --warnaserror. - Read and SemVer-validate the
package.jsonversion. - Pack the tool from source (
dotnet pack src/Build.slnx --configuration Release --no-build --output artifacts -p:Version=… -p:PackageVersion=…). - Install the packed tool from the
artifactssource into a temp tool path. - Dogfood: run the freshly installed
purview-buildagainst this repository. The tool restores, builds, lints, runs tests, packs, and validates itself. - Remove the temporary NuGet sources (
if: always()).
This repository’s purview-build.json sets Build:TestFilter to /*/*/*/*/, so the dogfood run executes every suite — unit and integration alike. Categories still come from the test project names — Build.UnitTests and Build.IntegrationTests — which the Purview SDK turns into assembly-level TUnit categories; no test writes a [Category] attribute by hand. Narrow to the unit suites locally with just test-unit.
The filter used to be /*/*/*/*[Category=Unit], which quietly excluded the integration suites from every PR and from the release. A suite that only ever runs on a developer’s machine is not a gate, so the filter now matches what just test runs.
Release (release.yml)
Section titled “Release (release.yml)”Runs on push to main and is serialized by its own concurrency group (purview-build-release, cancel-in-progress: false):
- Read the
package.jsonversion. This step is irreducible: the tool cannot read its own version fordotnet packbefore it has been packed. It makes no eligibility decision. - Configure NuGet sources with the shared
./actions/nuget-sourcesaction (nuget.org + the organisation feed). - Restore and build
src/Build.slnxwith--warnaserror. - Pack the tool from source with
-p:ContinuousIntegrationBuild=true. - Install the packed tool.
- Evaluate eligibility by running the freshly installed
purview-build release-explain --format=jsonand reading the verdict.Skipfinishes the job green,Failfails it with the rule’s message, andReleasecontinues. - Exchange the OIDC token for a short-lived nuget.org key (
NuGet/login), immediately before the push: the key lives for one hour and each token can be exchanged once. - Run the release pipeline with
Release__Modetaken from the evaluated decision, plusNuGet__FeedUrl=https://api.nuget.org/v3/index.json,Release__UploadArtifacts=true,Build__RunTests=false,Build__RunLint=false,Build__ValidatePack=true,NuGet__TrustedPublishing=true, andGITHUB_TOKEN. The minted key arrives asNUGET_API_KEY, andNUGET_APIKEYis blanked so a leftover secret can never shadow it. The workflow mapsPURVIEW_PUBLISH_GITHUB_PACKAGESontoNuGet__GitHubPackages__Enabledand passes the repository owner, so setting the variable makes this repository dual-publish; leaving it unset keeps NuGet.org-only publication. - Prune older GitHub Packages versions when the variable is set: keep the newest
PURVIEW_GITHUB_PACKAGES_KEEP_VERSIONS(default 1), never the version just released. Best effort — NuGet.org keeps every version. - Remove the temporary NuGet sources (
if: always()).
The workflow declares contents: write, packages: write, and id-token: write — the last is what the OIDC exchange needs, and GitHub withholds it by default. This repository dogfoods the eligibility evaluation as well as the pipeline: the git rev-parse tag check that used to live in this workflow is gone, replaced by the tool’s own rules.
The tool therefore publishes the immutable package to nuget.org (and, when opted in, GitHub Packages) and tags and releases itself (v{version} + generated-notes GitHub release with the package attached) — exactly like every other purview-dev repository. Maintainers bump the package.json version and merge; they do not create release tags manually.
GitHub package visibility
Section titled “GitHub package visibility”GitHub creates NuGet packages as private on first publication. Workflow access is independent of
visibility: the organisation-level PURVIEW_PACKAGES_READ_TOKEN secret lets every repository read
private packages too. For people, an organization owner can change a package to Internal in its
Package settings → Danger Zone (per package, UI only — there is no REST or GraphQL endpoint).
See Release Flow for the detail.