nuget-trusted-publishing
Fungsinya
Skill ini menyiapkan publikasi NuGet otomatis dari GitHub Actions memakai OpenID Connect, sehingga kunci API berumur panjang tidak diperlukan. Skill ini untuk pengelola paket .NET yang diterbitkan ke nuget.org.
Kapan dipakai
- βSaat Anda ingin menerbitkan paket NuGet dari GitHub Actions tanpa kunci API tersimpan.
- βSaat Anda memindahkan alur publikasi NuGet yang ada dari kunci API.
- βSaat Anda membuat alur publikasi NuGet baru dari awal.
Link skill
https://github.com/dotnet/skills/blob/main/plugins/dotnet-advanced/skills/nuget-trusted-publishing/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
βSiapkan publikasi tepercaya untuk paket NuGet saya agar alur GitHub Actions tidak lagi memerlukan kunci API.β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Agent memeriksa repo dan paket, memandu penyiapan publikasi tepercaya di nuget.org, memperbarui alur kerja agar memakai token berumur pendek, dan meminta izin sebelum menghapus rahasia lama.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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_KEYto 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@v1orid-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.
Find and classify packable projects β check
.csprojfiles andDirectory.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=trueor noOutputType) β Library <OutputType>Exe</OutputType>with<IsPackable>true</IsPackable>β Application package (not a tool, but still publishable)<OutputType>Exe</OutputType>withoutPackAsToolorIsPackableβ Not packable by default (ask user if they intend to publish it)
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.jsonincluded in packageTemplate PackageType=Template,.template.config/template.jsonunder content dirFind existing publish workflows in
.github/workflows/β look fordotnet nuget push,nuget push, ordotnet pack.Check version consistency β for MCP servers, verify
.csproj<Version>matches bothserver.jsonversion fields (rootversionandpackages[].version). Flag any mismatch.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_userbefore 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 ./artifactsto verify the .nupkg is created correctly."
dotnet pack -c Release -o ./artifactsβ verify.nupkgis created- For tools/MCP servers: install from
./artifacts, run--help, uninstall - For libraries: inspect the
.nupkgcontents (it's a zip)
Phase 3: nuget.org Policy
This phase requires the user to act on nuget.org β guide them with exact values.
Determine the repo owner, repo name, and the workflow filename that will publish.
β The policy requires the exact workflow filename (e.g., `pu
Pertanyaan umum
Apakah bekerja untuk feed privat?
Tidak. Skill hanya untuk nuget.org, bukan feed privat atau Azure Artifacts.
Apakah kunci API lama saya dihapus?
Tidak tanpa bertanya lebih dulu, karena menghapus rahasia dan mengubah ID paket memerlukan konfirmasi.
Apakah perlu GitHub Actions?
Ya. Skill hanya mencakup penyiapan GitHub Actions.
Detail
Deskripsi asli dari pembuat
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
Popularitas
- Bintang GitHub
- 5.8k
- Peringkat
- #14556
- Lisensi
- MIT
- Diperbarui
- 2/11/2026
Komentar
- β¦
Skill lain dari repositori ini
create-custom-agent
5.8kMembantu agent Anda membuat file agen kustom VS Code dengan alatnya sendiri, instruksi, dan serah terima ke agent lain.
create-skill
5.8kMembantu agent Anda membuat skill agent baru dengan nama yang valid, deskripsi pemicu yang jelas, dan file SKILL.md yang mengikuti standar.
csharp-scripts
5.8kMembantu agent Anda menjalankan program C# kecil sebagai satu file dengan alat baris perintah .NET, tanpa membuat proyek lengkap.
dotnet-pinvoke
5.8kMembantu agent Anda memanggil pustaka native C atau C++ dari .NET dengan benar, mencakup tanda tangan, penanganan string, memori, dan safe handle.
Skill serupa
openclaw-update
394kMembantu agent Anda memperbarui OpenClaw Gateway yang sudah ada, dengan memilih metode pembaruan yang sesuai cara pemasangannya dan menjaga sesi Anda tetap berjalan.
diagnose-gateway
394kMembantu agent Anda mencari tahu mengapa OpenClaw Gateway gagal dengan memeriksa pengaturan, channel, dan port tanpa mengubah apa pun.
crabbox-apps
394kMembantu agent Anda membuka dan menjalankan aplikasi di mesin cloud sementara, lalu menampilkan tampilannya di panel samping chat Anda.