Skip to content

Commit af47ecf

Browse files
committed
[CI] Publish .nupkg like offline pipeline artifact
1 parent f9b0d6b commit af47ecf

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

azure-pipelines.yml

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ stages:
2727
displayName: DotNetCore build
2828
steps:
2929
- task: UseDotNet@2
30-
displayName: 'Use .NET Core sdk'
30+
displayName: Use .NET Core sdk
3131
inputs:
3232
packageType: sdk
3333
version: '$(dotnetCoreVersion)'
34-
installationPath: $(Agent.ToolsDirectory)/dotnet
34+
installationPath: '$(Agent.ToolsDirectory)/dotnet'
3535
- task: PowerShell@2
3636
displayName: 'Install paket and dependencies'
3737
inputs:
@@ -41,19 +41,19 @@ stages:
4141
dotnet paket restore
4242
dotnet paket install
4343
- task: UseDotNet@2
44-
displayName: 'Use .NET Core sdk'
44+
displayName: Use .NET Core sdk
4545
inputs:
4646
packageType: sdk
4747
version: '$(dotnetCoreVersion)'
48-
installationPath: $(Agent.ToolsDirectory)/dotnet
48+
installationPath: '$(Agent.ToolsDirectory)/dotnet'
4949
# Restore from an feed scoped feed in the same feed
5050
- task: NuGetCommand@2
5151
name: Restore
5252
displayName: Nuget Restore
5353
inputs:
5454
command: restore
5555
feedsToUse: config
56-
nugetConfigPath: 'nuget.config'
56+
nugetConfigPath: nuget.config
5757
vstsFeed: '$(feed)'
5858
restoreSolution: '$(solution)'
5959
- task: DotNetCoreCLI@2
@@ -71,11 +71,11 @@ stages:
7171
- stage: GeneratePackage
7272
displayName: Create Nuget .nupkg package
7373
dependsOn: Build
74-
condition: startsWith(variables['build.sourceBranch'], 'refs/tags/')
7574
jobs:
7675
- job: Pack
7776
displayName: Package the component
7877
steps:
78+
# Create a ENV variable with latest Git tag
7979
- task: PowerShell@2
8080
displayName: Set last tag to environment variable
8181
inputs:
@@ -95,8 +95,16 @@ stages:
9595
configuration: '$(buildConfiguration)'
9696
packagesToPack: '$(libProject)/*.csproj'
9797
packDestination: '$(Build.ArtifactStagingDirectory)'
98+
includeSymbols: true
99+
# Publish the generated file like a pipeline artifact
100+
- task: PublishBuildArtifacts@1
101+
displayName: Publish .nupkg like a pipeline artifact
102+
inputs:
103+
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
104+
ArtifactName: '$(libProject).$(VERSION_TAG)'
105+
98106
- stage: Publish
99-
displayName: Publish package to Azure Devops Artifacts
107+
displayName: Publish package to Azure Devops Artifacts feed
100108
condition: startsWith(variables['build.sourceBranch'], 'refs/tags/')
101109
jobs:
102110
- job: AuthenticateAndPublish
@@ -115,7 +123,7 @@ stages:
115123
- task: NuGetAuthenticate@0
116124
name: Authenticate
117125
displayName: NuGet Authentication on private feed
118-
# PS: Azure Artifacts don't supports .snupkg symbols file
126+
# PS: Azure Artifacts don't supports ".snupkg" symbols file
119127
- task: PublishSymbols@2
120128
displayName: Publish the symbols *.pdb to Azure Artifacts
121129
inputs:
@@ -128,9 +136,10 @@ stages:
128136
command: push
129137
versioningScheme: byEnvVar
130138
versionEnvVar: '$(VERSION_TAG)'
131-
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg'
139+
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;$(Build.ArtifactStagingDirectory)/**/*.snupkg'
132140
feedsToUse: config
141+
nuGetFeedType: internal
133142
nugetConfigPath: '$(Build.WorkingDirectory)/nuget.config'
134-
allowPackageConflicts: false
143+
publishVstsFeed: '$(feed)'
144+
allowPackageConflicts: true
135145
includeNuGetOrg: false
136-
vstsFeed: '$(feed)'

0 commit comments

Comments
 (0)