본문으로 건너뛰기
Skillpedia
배포 및 클라우드 (DevOps)5.8k · #14556

nuget-trusted-publishing

하는 일

이 스킬은 OpenID Connect를 사용해 GitHub Actions에서 NuGet 패키지를 자동으로 게시하도록 설정합니다. 오래 유지되는 API 키가 필요 없어집니다. nuget.org에 .NET 패키지를 게시하는 관리자를 위한 스킬입니다.

사용하는 경우

  • ✓저장된 API 키 없이 GitHub Actions에서 NuGet 패키지를 게시하고 싶을 때.
  • ✓기존 NuGet 게시 워크플로를 API 키에서 옮기고 있을 때.
  • ✓GitHub Actions에서 새 NuGet 게시 워크플로를 처음부터 만들 때.

스킬 링크

https://github.com/dotnet/skills/blob/main/plugins/dotnet-advanced/skills/nuget-trusted-publishing/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/dotnet/skills/blob/main/plugins/dotnet-advanced/skills/nuget-trusted-publishing/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“NuGet 패키지에 신뢰 게시를 설정해서 GitHub Actions 워크플로가 더 이상 API 키를 쓰지 않도록 해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트가 저장소와 패키지를 확인하고, nuget.org의 신뢰 게시 설정을 안내하고, 수명이 짧은 토큰을 쓰도록 워크플로를 고치며, 오래된 비밀 값을 지우기 전에는 먼저 확인을 받습니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

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.

  1. Find and classify packable projects — check .csproj files and Directory.Build.props (package metadata is often set repo-wide). Classify in this order (earlier matches win):

    • <PackageType>Template</PackageType> → Template
    • <PackageType>McpServer</PackageType> → MCP server (also a dotnet tool)
    • <PackAsTool>true</PackAsTool> → Dotnet tool
    • Class library (IsPackable=true or no OutputType) → Library
    • <OutputType>Exe</OutputType> with <IsPackable>true</IsPackable> → Application package (not a tool, but still publishable)
    • <OutputType>Exe</OutputType> without PackAsTool or IsPackable → Not packable by default (ask user if they intend to publish it)
  2. Validate structure for each project's type:

    Type Required
    All PackageId, Version (in .csproj or Directory.Build.props)
    Dotnet tool PackAsTool (required); ToolCommandName (optional but recommended — defaults to assembly name)
    MCP server PackageType=McpServer, .mcp/server.json included in package
    Template PackageType=Template, .template.config/template.json under content dir
  3. Find existing publish workflows in .github/workflows/ — look for dotnet nuget push, nuget push, or dotnet pack.

  4. Check version consistency — for MCP servers, verify .csproj <Version> matches both server.json version fields (root version and packages[].version). Flag any mismatch.

  5. Report findings to the user: classification, missing properties, version mismatches, existing workflows. For multi-project repos, note whether one workflow or separate workflows per package are needed. Offer to fix gaps — use ask_user before modifying project files.

❌ See references/package-types.md for per-type details and required properties.

Phase 2: Local Verification

Pack and verify locally before touching nuget.org — publishing errors waste a permanent version number.

⚠️ Always mention this step, even if you defer running it. Tell the user: "Before your first publish, run dotnet pack -c Release -o ./artifacts to verify the .nupkg is created correctly."

  1. dotnet pack -c Release -o ./artifacts — verify .nupkg is created
  2. For tools/MCP servers: install from ./artifacts, run --help, uninstall
  3. For libraries: inspect the .nupkg contents (it's a zip)

Phase 3: nuget.org Policy

This phase requires the user to act on nuget.org — guide them with exact values.

  1. Determine the repo owner, repo name, and the workflow filename that will publish.

    ❌ The policy requires the exact workflow filename (e.g., `pu

자주 묻는 질문

비공개 피드에서도 되나요?

아니요. nuget.org 전용이며, 비공개 피드나 Azure Artifacts는 다루지 않습니다.

기존 API 키를 삭제하나요?

먼저 묻지 않고 삭제하지 않습니다. 비밀 값 삭제와 패키지 ID 변경에는 확인이 필요하기 때문입니다.

GitHub Actions가 필요한가요?

네. GitHub Actions 설정만 다룹니다.

상세 정보

작성자의 원본 설명

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.

repo: dotnet/skills

인기도

GitHub 스타
5.8k
순위
#14556
라이선스
MIT
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬