Skills

Nuget Trusted Publishing

Set up NuGet trusted publishing (OIDC) on a GitHub Actions repo, replaces long-lived...

Install

npx skills add dotnet/skills --skill nuget-trusted-publishing -g -a claude-code -y
Repository
dotnet/skills5.8k
Category
DevOps
Updated
3d ago
License
MIT
Context cost
Mediumabout 2,192 tokens
Runs scripts
No, instructions only

What it does

Set up NuGet trusted publishing (OIDC) on a GitHub Actions repo, replaces long-lived API keys with short-lived tokens. USE FOR: trusted publishing, NuGet OIDC, keyless NuGet publish, migrate from NuGet API key, NuGet/login, secure NuGet publishing. DO NOT USE FOR: publishing to private feeds or Azure Artifacts (OIDC is nuget.org only). INVOKES: shell (powershell or bash), edit, create, ask_user for guided repo setup.

NuGet Trusted Publishing Setup

Set up NuGet trusted publishing on a GitHub Actions repo. Replaces long-lived API keys with OIDC-based short-lived tokens, no secrets to rotate or leak.

Prerequisites

  • GitHub Actions, this skill covers GitHub Actions setup only
  • nuget.org account, the user needs access to create trusted publishing policies

When to Use This Skill

Use this skill when:

  • Setting up trusted publishing for a NuGet package
  • Migrating from secrets.NUGET_API_KEY to OIDC-based publishing
  • Asked about keyless or secure NuGet publishing
  • Creating a new NuGet publish workflow from scratch
  • Asked to "remove NuGet API key" or "use NuGet/login"
  • Setting up publishing for a dotnet tool, MCP server, or template package
  • Asked about NuGet/login@v1 or id-token: write

Safety Rules

⚠️ Bail-out rule: If any phase fails after one fix attempt on an infrastructure/auth issue, stop and ask the user. Don't loop on environment problems.

⚠️ Never delete or overwrite without confirmation: Removing API key secrets, deleting tags/releases, removing workflow steps, or changing package IDs. NuGet package IDs are permanent, mistakes can't be undone.

Process

Fast-path for greenfield repos: When the user has a simple setup (one packable project, no existing publish workflow), don't gate on multi-turn assessment. Combine phases: create the workflow immediately, include nuget.org policy guidance, local pack recommendation, and filename-matching warning all in one response. The full phased process below is for complex or migration scenarios.

Phase 1: Assess

Inspect the repo and report findings before making any changes.

Read the whole SKILL.md on GitHub

More in DevOps