Skip to content

Publish with trusted publishing, from a tag - #18

Merged
arnelirobles merged 1 commit into
mainfrom
ci/trusted-publishing
Aug 18, 2026
Merged

Publish with trusted publishing, from a tag#18
arnelirobles merged 1 commit into
mainfrom
ci/trusted-publishing

Conversation

@arnelirobles

Copy link
Copy Markdown
Contributor

Closes #14.

What changes

before after
credential secrets.NUGET_API_KEY, long-lived OIDC exchange for a key valid one hour
trigger workflow_dispatch only v* tag push, plus dispatch for dry runs
version typed at dispatch read from the tag
dry run none default on dispatch, and it exercises the OIDC policy
checks its own tests plus the audit and formatting ci.yml runs

The credential

This is the org's most-downloaded package at 66,043, and it was the one holding a standing publish credential. The runner now mints a short-lived token that nuget.org exchanges for a key scoped by policy. Nothing is stored and nothing can be replayed.

umbraco-pwa has published this way since August, so this is a known-good pattern rather than a first attempt.

Once a publish succeeds without it, delete NUGET_API_KEY from repository secrets and revoke it on nuget.org.

The version

dotnet pack /p:Version=${{ inputs.version }} meant the published version was whatever someone typed into a dispatch box. Nothing recorded which commit produced 1.2.3. It now comes from the tag, and a tag that is not vMAJOR.MINOR.PATCH fails the run rather than publishing something odd.

The dry run, which is the point

The OIDC exchange runs on dry runs too. Obtaining a key publishes nothing, so a dispatch with dry_run ticked genuinely verifies the trusted publishing policy is configured correctly.

That is deliberate. .github/DELIVERY.md records what happens otherwise: a release gate whose first execution is a real release. That cost umbraco-pwa a failed 0.3.0 publish tonight, on a gate that had been merged weeks earlier and had never once run.

Please dispatch this with dry_run ticked before tagging anything.

A correction to #14

I claimed the old workflow had no test step and "will publish from a red tree". That was wrong; it ran dotnet test before pushing. The accurate point is narrower: it ran its own tests but not the audit, formatting or dependency-free checks from ci.yml, so those could be red while it published. This adds them.

Checked before committing

dotnet format --verify-no-changes exits 0 on main today, so the new formatting step will not fail the first run on unrelated drift.

Replaces the long-lived NUGET_API_KEY with an OIDC exchange for a
short-lived key, takes the version from the tag rather than a typed input
so it is recorded in git, and adds a dry run that exercises the trusted
publishing policy without publishing.

Also runs the audit and formatting checks the job previously skipped, so it
cannot publish while ci.yml is red.
@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@arnelirobles, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 7 seconds

Limit details: You’ve used all 3 included reviews currently available under your plan.

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1036fcc8-ae8e-4355-8a94-83d519ae2b37

📥 Commits

Reviewing files that changed from the base of the PR and between 2781bdf and d98c0c5.

📒 Files selected for processing (1)
  • .github/workflows/publish.yml

Comment @coderabbitai help to get the list of available commands.

@arnelirobles
arnelirobles merged commit b7c76d9 into main Aug 18, 2026
8 checks passed
@arnelirobles
arnelirobles deleted the ci/trusted-publishing branch August 18, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Publish with trusted publishing instead of a long-lived NuGet API key

1 participant