Skip to content

Commit

Permalink
Update cli-ref-push.md
Browse files Browse the repository at this point in the history
  • Loading branch information
erdembayar authored Jun 18, 2022
1 parent 4a1c908 commit 6f213bd
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions docs/reference/cli-reference/cli-ref-push.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,17 @@ nuget push foo.nupkg 4003d786-cc37-4004-bfdf-c4f3e8ef9b3a -src https://customsou
nuget push Foo.5.0.2.nupkg 4003d786-cc37-4004-bfdf-c4f3e8ef9b3a -src https://api.nuget.org/v3/index.json -SkipDuplicate
:: In the example below pushing "Foo" version "5.0.2" to Azure DevOps Artifacts from dev box, here AZ is just a placeholder for ApiKey, this prevents authentication fail prematurely, in order to authentication to work you need to install [cred provider](https://github.com/microsoft/artifacts-credprovider). Below command trigger open Cred Provider window if authentication is necessary, it's suitable for pushing from dev box, but not for CI.
nuget push Foo.5.0.2.nupkg -src https://dev.azure.com/yourAzureDevOpsFeed/nuget/v3/index.json AZ
nuget push Foo.5.0.2.nupkg -src https://pkgs.dev.azure.com/{organization}/{project}/_packaging/{feed}/nuget/v3/index.json AZ
:: In the example below pushing "Foo" version "5.0.2" to Azure DevOps Artifacts from CI, here AZ is just a placeholder for ApiKey, this prevents authentication fail prematurely. You need to setup [NuGet Authenticate task](https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/package/nuget-authenticate?view=azure-devops) with [NuGet service connection](https://docs.microsoft.com/en-us/azure/devops/pipelines/library/service-endpoints?view=azure-devops&tabs=yaml#nuget-service-connection) for authenticate with external Azure DevOps Artifacts server.
:: In the example below pushing "Foo" version "1.1.6" to Azure DevOps Artifacts from CI, here AZ is just a placeholder for ApiKey, this prevents authentication fail prematurely. You need to setup [NuGet Authenticate task](https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/package/nuget-authenticate?view=azure-devops) with [NuGet service connection](https://docs.microsoft.com/en-us/azure/devops/pipelines/library/service-endpoints?view=azure-devops&tabs=yaml#nuget-service-connection) for authenticate with external Azure DevOps Artifacts server.
- task: NuGetAuthenticate@1
inputs:
nuGetServiceConnections: MyServiceConnection_ExternalServer
- powershell: |
nuget push *.nupkg -source https://pkgs.dev.azure.com/{organization}/{project}/_packaging/{feed}/nuget/v3/index.json AZ
displayName: "Push"
- task: NuGetAuthenticate@1
inputs:
nuGetServiceConnections: MyServiceConnection_ExternalServer
- bash: |
dotnet build foo/foo.csproj -c Release
dotnet pack foo/foo.csproj /property:PackageVersion=1.1.6 -o nupkgs -c Release
nuget push nupkgs/foo.1.1.6.nupkg -src https://pkgs.dev.azure.com/{organization}/{project}/_packaging/{feed}/nuget/v3/index.json AZ
displayName: "Pack and push"
```

0 comments on commit 6f213bd

Please sign in to comment.