Skip to content

ci: manual NuGet publish workflow + bump to 0.6.0#8

Merged
thygrrr merged 2 commits into
mainfrom
ci/nuget-publish-workflow
Jun 16, 2026
Merged

ci: manual NuGet publish workflow + bump to 0.6.0#8
thygrrr merged 2 commits into
mainfrom
ci/nuget-publish-workflow

Conversation

@thygrrr

@thygrrr thygrrr commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Adds a manually-triggered release pipeline and bumps the package to 0.6.0. Publishing uses NuGet Trusted Publishing (OIDC) — no long-lived API key is stored.

.github/workflows/publish.yml

  • Trigger: workflow_dispatch (manual only), with a dry_run boolean input that packs without pushing — handy for validating the pipeline.
  • Steps: checkout → setup-dotnet 10.0.xdotnet restoretestpack (Release) → upload .nupkg artifact → NuGet login (OIDC)push to nuget.org.
  • Trusted Publishing: permissions: id-token: write lets the job request a GitHub OIDC token; NuGet/login@v1 exchanges it for a short-lived API key tied to a nuget.org Trusted Publishing policy. The push then uses that temporary key (steps.nuget-login.outputs.NUGET_API_KEY). No NUGET_API_KEY secret needed.
  • Test gate runs in Debug. The constraints feature emits its validation throw under #if DEBUG, so the *_Throws tests only pass in Debug (same as the existing CI). Packing is still done in Release.
  • Push: dotnet nuget push --skip-duplicate so re-runs of the same version don't hard-fail.

Version

  • newtype 0.5.10.6.0 in NewType.Generator.csproj.

Validation

Packed locally in Release — produces newtype.0.6.0.nupkg with the expected layout:

  • analyzers/dotnet/cs/NewType.Generator.dll
  • NUGET.md (readme), icon.png, LICENSE
  • nuspec: <id>newtype</id>, <version>0.6.0</version>

⚠️ Required before first publish

  1. Configure a Trusted Publishing policy on nuget.org (account → Trusted Publishing) for:
    • Repository owner outfox, repository newtype, workflow file publish.yml (optionally pin an environment).
  2. Add a NUGET_USER repository variable (Settings → Secrets and variables → Actions → Variables) set to the nuget.org account/username that owns the policy. It's a variable, not a secret — the username isn't sensitive.

No API-key secret is required. Run it from the Actions tab → "Publish to NuGet" → Run workflow (optionally tick dry_run first to verify packing).

- .github/workflows/publish.yml: workflow_dispatch-triggered pipeline
  that restores, runs the test suite (Debug, matching CI — the
  constraint `*_Throws` tests are #if DEBUG-gated), packs the generator
  in Release, uploads the .nupkg artifact, and pushes to nuget.org with
  --skip-duplicate. A `dry_run` input packs without pushing.
- Bump newtype package version 0.5.1 -> 0.6.0.

Requires a NUGET_API_KEY repository secret for the push step.
@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@thygrrr, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 48 minutes and 41 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

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.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cebba1bf-02f0-4e99-a3ee-3ee1fffce826

📥 Commits

Reviewing files that changed from the base of the PR and between ea0d2db and acd7162.

📒 Files selected for processing (2)
  • .github/workflows/publish.yml
  • NewType.Generator/NewType.Generator.csproj
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/nuget-publish-workflow

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Replace the NUGET_API_KEY secret with NuGet Trusted Publishing:
- add `id-token: write` permission to request a GitHub OIDC token
- use NuGet/login@v1 to exchange the OIDC token for a short-lived API
  key (gated on !dry_run), keyed to a nuget.org Trusted Publishing
  policy; the nuget.org account is read from the NUGET_USER repo variable
- push using the temporary key from the login step's output

No long-lived secret is stored. Requires a Trusted Publishing policy on
nuget.org (repo outfox/newtype, workflow publish.yml) and a NUGET_USER
repository variable.
@thygrrr thygrrr merged commit c5912f7 into main Jun 16, 2026
2 checks passed
@thygrrr thygrrr deleted the ci/nuget-publish-workflow branch June 16, 2026 16:47
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.

1 participant