Skip to content

Commit fac3f64

Browse files
authored
💚 azure-pipelines: Fix nuget push due to duplicates (#1173)
Use nuget CLI directly to skip duplicates. Include `.snupkg` files.
1 parent 0628c3c commit fac3f64

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

azure-pipelines.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,28 +76,27 @@ steps:
7676
SourceFolder: '$(Build.SourcesDirectory)/Artifacts'
7777
Contents: |
7878
**/*.nupkg
79-
**/*.symbols.nupkg
79+
**/*.snupkg
8080
TargetFolder: '$(Build.ArtifactStagingDirectory)'
8181
flattenFolders: true
8282
preserveTimestamp: true
8383
retryCount: '3'
8484
ignoreMakeDirErrors: true
8585

86+
- task: Bash@3
87+
displayName: 'Push to nuget.org'
88+
env:
89+
NUGET_ORG_APIKEY: '$(NUGET_ORG_APIKEY)'
90+
inputs:
91+
targetType: 'inline'
92+
script: 'dotnet nuget push "*.nupkg" --skip-duplicate --api-key $(NUGET_ORG_APIKEY) --source https://api.nuget.org/v3/index.json'
93+
workingDirectory: '$(Build.ArtifactStagingDirectory)'
94+
8695
- task: NuGetCommand@2
8796
displayName: Push to internal NuGet feed
8897
inputs:
8998
command: 'push'
90-
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
99+
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg'
91100
nuGetFeedType: 'internal'
92101
publishVstsFeed: 'fee4c64f-3e49-4618-9ea4-5a3167257c37/989275f4-a952-4abd-ae82-2e7a0cb97b9b'
93102
allowPackageConflicts: true
94-
95-
- task: NuGetCommand@2
96-
displayName: Push to nuget.org
97-
continueOnError: true # allowPackageConflicts option does not work with external feeds 🤷
98-
inputs:
99-
command: 'push'
100-
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/'
101-
nuGetFeedType: 'external'
102-
publishFeedCredentials: 'nuget.org (UnitsNet)'
103-
allowPackageConflicts: true

0 commit comments

Comments
 (0)