nuget-trusted-publishing

Migrate NuGet publishing to OIDC-based tokens in GitHub Actions.

2|Updated Mar 17, 2026
One-click install
npx skills add https://github.com/sayedihashimi/copilot-skill-eval --skill nuget-trusted-publishing-sayedihashimi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nuget-trusted-publishing
Source: https://github.com/sayedihashimi/copilot-skill-eval/tree/main/examples/aspnet-razor-pages/plugins/dotnet-skills/dotnet/skills/nuget-trusted-publishing
Command: npx skills add https://github.com/sayedihashimi/copilot-skill-eval --skill nuget-trusted-publishing-sayedihashimi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

NuGet trusted publishing replaces long-lived API keys with short-lived tokens in GitHub Actions, enabling secure and maintainable NuGet publishing workflows.

Core Features & Use Cases

  • Provide OIDC-based authentication for NuGet publishing to nuget.org
  • Migrate from NuGet_API_KEY to token-based workflows and integrate with NuGet/login
  • Create or guide a publish workflow with environment protection and policy compliance

Quick Start

Prompt Copilot to set up a GitHub Actions workflow that uses NuGet trusted publishing for your NuGet packages.

Frequently Asked Questions about nuget-trusted-publishing

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

FAQPage Schema
How do I publish NuGet packages to nuget.org without long-lived API keys?

You can publish to nuget.org without API keys by implementing NuGet trusted publishing, which replaces long-lived secrets with short-lived OIDC tokens. This workflow uses GitHub Actions with id-token: write permissions and the NuGet/login action to authenticate securely.

What is OIDC-based trusted publishing for NuGet?

OIDC-based trusted publishing for NuGet is a mechanism that replaces long-lived API keys with short-lived tokens in GitHub Actions. It uses OpenID Connect to authenticate directly with nuget.org, ensuring secure and maintainable package publishing workflows.

How do I migrate my NuGet publishing workflow from API keys to OIDC tokens?

To migrate from API keys to OIDC tokens, update your GitHub Actions workflow to use id-token: write permissions and integrate the NuGet/login@v1 action. This removes the need for stored NuGet_API_KEY secrets and uses short-lived tokens instead.

Can I use GitHub Actions to securely publish NuGet packages with environment protection?

Yes, you can create a GitHub Actions publish workflow that uses OIDC tokens for NuGet trusted publishing while enforcing environment protection and policy compliance. This ensures secure deployments to nuget.org without exposing long-lived secrets.

Does NuGet trusted publishing with OIDC tokens work for private feeds?

No, OIDC-based trusted publishing for NuGet is designed specifically for publishing to nuget.org. The workflow avoids publishing to private feeds and focuses on secure, token-based authentication for the public gallery.

Why should I use OIDC tokens instead of a NuGet API key in GitHub Actions?

You should use OIDC tokens instead of a NuGet API key to eliminate the security risks of storing long-lived secrets. OIDC tokens are short-lived and requested on demand, making your GitHub Actions NuGet publishing workflows more secure and maintainable.