Skip to content

Commit 0608a27

Browse files
committed
💚 Skip duplicates when pushing nugets
Based on fac3f64 in master.
1 parent 8c2f414 commit 0608a27

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

azure-pipelines.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Add steps that build, run tests, deploy, and more:
44
# https://aka.ms/yaml
55

6-
trigger:
6+
trigger:
77
branches:
88
include:
99
- master
@@ -27,7 +27,7 @@ steps:
2727
fetchTags: false
2828

2929
- task: InstallNanoMSBuildComponents@1
30-
displayName: Install .NET nanoFramework MSBuild components
30+
displayName: Install .NET nanoFramework MSBuild components
3131

3232
- task: PowerShell@2
3333
displayName: 'Build, test, pack'
@@ -48,21 +48,21 @@ steps:
4848
targetType: 'inline'
4949
script: |
5050
Write-Host -Foreground Green "Downloading codecov binaries..."
51-
52-
Invoke-WebRequest -Uri https://uploader.codecov.io/verification.gpg -OutFile codecov.asc
51+
52+
Invoke-WebRequest -Uri https://uploader.codecov.io/verification.gpg -OutFile codecov.asc
5353
gpg.exe --import codecov.asc
54-
54+
5555
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe
5656
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe.SHA256SUM -Outfile codecov.exe.SHA256SUM
5757
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe.SHA256SUM.sig -Outfile codecov.exe.SHA256SUM.sig
58-
58+
5959
gpg.exe --verify codecov.exe.SHA256SUM.sig codecov.exe.SHA256SUM
6060
If ($(Compare-Object -ReferenceObject $(($(certUtil -hashfile codecov.exe SHA256)[1], "codecov.exe") -join " ") -DifferenceObject $(Get-Content codecov.exe.SHA256SUM)).length -eq 0) { echo "SHASUM verified" } Else {exit 1}
61-
61+
6262
Write-Host -Foreground Green "Uploading to codecov..."
63-
63+
6464
.\codecov.exe --dir "Artifacts/Coverage" -t "$env:CODECOV_TOKEN" --build "$(Build.BuildNumber)"
65-
65+
6666
Write-Host -Foreground Green "✅ Uploaded to codecov."
6767
pwsh: true
6868

@@ -76,28 +76,28 @@ steps:
7676
SourceFolder: '$(Build.SourcesDirectory)/Artifacts'
7777
Contents: |
7878
**/*.nupkg
79+
**/*.snupkg
7980
**/*.symbols.nupkg
8081
TargetFolder: '$(Build.ArtifactStagingDirectory)'
8182
flattenFolders: true
8283
preserveTimestamp: true
8384
retryCount: '3'
8485
ignoreMakeDirErrors: true
8586

87+
- task: Bash@3
88+
displayName: 'Push to nuget.org'
89+
env:
90+
NUGET_ORG_APIKEY: '$(NUGET_ORG_APIKEY)'
91+
inputs:
92+
targetType: 'inline'
93+
script: 'dotnet nuget push "*.nupkg" --skip-duplicate --api-key $(NUGET_ORG_APIKEY) --source https://api.nuget.org/v3/index.json'
94+
workingDirectory: '$(Build.ArtifactStagingDirectory)'
95+
8696
- task: NuGetCommand@2
8797
displayName: Push to internal NuGet feed
8898
inputs:
8999
command: 'push'
90-
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
100+
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg'
91101
nuGetFeedType: 'internal'
92102
publishVstsFeed: 'fee4c64f-3e49-4618-9ea4-5a3167257c37/989275f4-a952-4abd-ae82-2e7a0cb97b9b'
93103
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)