Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Publishing .NET Packages to NuGet.org with an API Key

Description and use

Automated publishing of .NET packages to NuGet.org with secure API key handling via GitHub Actions.

Problem

Automating the publishing of .NET libraries to NuGet.org while keeping API keys secure.

Outcome

Automated, secure publishing of .NET packages with minimal manual intervention and reduced risk of credential leakage.

Workflow

  • Create a NuGet API key with Push scope and optional package pattern
  • Store the API key as a GitHub Actions repository secret (e.g., NUGET_API_KEY)
  • Add a workflow step that runs dotnet nuget push with --api-key "$NUGET_API_KEY" and --source https://api.nuget.org/v3/index.json
  • Optionally include --skip-duplicate to avoid failures on reruns

Evidence

never commit the API key into the repository

Source

The basic command is: dotnet nuget push <PACKAGE_FILE> --api-key <YOUR_API_KEY> --source https://api.nuget.org/v3/index.json

Source

  • Record date: 2026-09-15T18:30:21.148Z