Skip to content

Commit 3eb3ec9

Browse files
committed
#314 Update pipeline to pack and publish NuGet packages with symbols
Pipeline now packs the library with symbols and SourceLink metadata before publishing, ensuring both nupkg and snupkg files are available as build artifacts. The publish step now pushes both package types and excludes legacy symbols.nupkg files.
1 parent 6e184b4 commit 3eb3ec9

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

azure-pipelines.yml

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@ steps:
4141
command: 'build'
4242
projects: '**/Xunit.Microsoft.DependencyInjection.csproj'
4343
arguments: '--configuration $(BuildConfiguration)'
44+
45+
# Pack (with symbols & SourceLink) happens before publish to ensure packages are available as build artifacts
46+
- script: echo Packing library with symbols and SourceLink metadata
47+
displayName: 'Pre-Pack Info'
48+
- task: DotNetCoreCLI@2
49+
displayName: 'Packing (nupkg + snupkg)'
50+
inputs:
51+
command: 'pack'
52+
packagesToPack: '**/Xunit.Microsoft.DependencyInjection.csproj'
53+
arguments: '--configuration $(BuildConfiguration) /p:ContinuousIntegrationBuild=true /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg --output $(Build.ArtifactStagingDirectory)/packages'
54+
nobuild: true
4455
- task: DotNetCoreCLI@2
4556
displayName: 'Running tests in example folder'
4657
continueOnError: true
@@ -68,18 +79,19 @@ steps:
6879

6980
- script: echo Started packing and pushing
7081

71-
- task: NuGetCommand@2
72-
displayName: 'Packing'
82+
- task: PublishBuildArtifacts@1
83+
displayName: 'Publish Packages'
7384
inputs:
74-
command: 'pack'
75-
packagesToPack: '**/Xunit.Microsoft.DependencyInjection.csproj'
76-
versioningScheme: 'byEnvVar'
77-
versionEnvVar: 'Build.BuildNumber'
85+
PathtoPublish: '$(Build.ArtifactStagingDirectory)/packages'
86+
ArtifactName: 'packages'
87+
publishLocation: 'Container'
88+
89+
# Push both nupkg & snupkg (exclude legacy symbols.nupkg)
7890
- task: NuGetCommand@2
7991
displayName: 'Pushing to nuget.org'
8092
inputs:
8193
command: 'push'
82-
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
94+
packagesToPush: '$(Build.ArtifactStagingDirectory)/packages/**/*.nupkg;$(Build.ArtifactStagingDirectory)/packages/**/*.snupkg'
8395
nuGetFeedType: 'external'
8496
publishFeedCredentials: 'NuGet'
8597
allowPackageConflicts: true

0 commit comments

Comments
 (0)