Rulebearing Playground Coverage Schemas GitHub

ADR-0070: A new NuGet package ID is first pushed with the stored key

Context

ADR-0068 assumed that the trusted-publishing policy, with the scope "push new packages and package versions" and the glob Rulebearing*, would let the release create the package IDs that did not exist yet. It did not.

In the v0.1.1 release, nuget-publish exchanged its OIDC token and pushed Rulebearing 0.1.1. nuget.org then refused Rulebearing.Analyzer with 403 ("does not have permission to access the specified package"). A rerun with the same policy, which shows the scope and glob above and is Active, failed the same way.

nuget.org's documentation says a policy "will apply to all packages owned by the selected owner". A package ID that does not exist has no owner, so the policy's key cannot create it. The seven Rulebearing.TestAdapter* packages and Rulebearing.Analyzer were therefore not published.

Decision

nuget-publish tries the trusted-publishing key for every package, and falls back to NUGET_API_KEY for a package that key cannot push. A push that fails with 403 is retried with the NUGET_API_KEY secret. That key has the scope "push new packages and package versions" and the glob Rulebearing*. The job writes a notice naming the package. A failure that is not a 403, or a 403 with the secret unset, fails the job and names the package.

NUGET_API_KEY stays as a repository secret. It is used only for a package's first push. Every later version of that package goes through the policy, because by then the package has an owner.

Consequences

Alternatives considered