nuget-trusted-publishing

Configure OIDC-based NuGet trusted publishing in GitHub Actions workflows.

1|Updated Jun 1, 2026
One-click install
npx skills add https://github.com/D1ssolve/craft-agents --skill nuget-trusted-publishing-d1ssolve
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nuget-trusted-publishing
Source: https://github.com/D1ssolve/craft-agents/tree/main/skills/nuget-trusted-publishing
Command: npx skills add https://github.com/D1ssolve/craft-agents --skill nuget-trusted-publishing-d1ssolve

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Publishing NuGet packages with long-lived API keys creates security risks from leaked or stale secrets that must be manually rotated. This Skill replaces those keys with OIDC-based short-lived tokens via NuGet trusted publishing, guiding the full setup on GitHub Actions repos. ## Core Features & Use Cases - Repo Assessment: Classifies packable projects (library, dotnet tool, MCP server, template) by inspecting .csproj and Directory.Build.props, then validates required properties and version consistency. - Guided nuget.org Policy Setup: Walks the user through creating a trusted publishing policy with the exact repository owner, repo name, and workflow filename, plus an optional GitHub Environment for secret scoping. - Workflow Creation and Migration: Generates a tag-triggered publish workflow using NuGet/login@v1 with id-token: write, or migrates an existing API-key workflow in place. - Use Case: A maintainer wants to remove secrets.NUGET_API_KEY from their repo. The Skill inspects the project, guides the nuget.org policy creation, rewrites the publish workflow to use OIDC tokens, and provides troubleshooting for common failures like 403 errors or filename mismatches. ## Quick Start Set up NuGet trusted publishing with OIDC for my GitHub Actions repo and migrate my publish workflow away from API keys.

Frequently Asked Questions about nuget-trusted-publishing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up NuGet trusted publishing with GitHub Actions?

Create a trusted publishing policy on nuget.org with your repository owner, repo name, and exact workflow filename, then add id-token: write permission and a NuGet/login@v1 step to your workflow. Use the token from the login step's output in dotnet nuget push instead of an API key.

How to migrate from NuGet API key to OIDC publishing?

Add id-token: write to the job permissions, insert a NuGet/login@v1 step with your nuget.org username as the NUGET_USER secret, and replace the API key with steps.login.outputs.NUGET_API_KEY. Keep the old API key secret until the first OIDC publish succeeds.

Does NuGet trusted publishing work with private feeds or Azure Artifacts?

No, NuGet trusted publishing via OIDC works only with nuget.org. Publishing to private feeds or Azure Artifacts requires different authentication methods and is outside this approach's scope.

Why does NuGet/login fail with a 403 error?

A 403 from NuGet/login almost always means the job is missing the id-token: write permission. Add it to the job's permissions block alongside contents: read, since setting permissions overrides GitHub's defaults.

Why does trusted publishing report no matching policy?

The nuget.org policy must match the exact workflow filename, such as publish.yml, with no path prefix; matching is case-insensitive. The workflow name field is not used, so verify the filename on nuget.org matches the actual file.