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

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

Описание и применение

Автоматизированный процесс публикации .NET‑пакетов в NuGet.org с безопасным хранением ключа API в GitHub Actions.

Задача

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

Результат

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

Рабочий процесс

  • 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

Доказательства

never commit the API key into the repository

Источник

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

Источник

  • Дата записи: 2026-09-15T18:30:21.148Z