-
Notifications
You must be signed in to change notification settings - Fork 28
/
azure-pipelines-nuget.yml
67 lines (59 loc) · 2.08 KB
/
azure-pipelines-nuget.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Azure Pipelines for NuGet :)
# More info: https://docs.microsoft.com/en-us/azure/devops/pipelines/?view=vsts
parameters:
Name: 'NuGetCI'
RestoreBuildProjects: '**/*.SDK.csproj'
WorkingDirectory: 'src'
BuildConfiguration: 'Release'
Major: '1'
Minor: '0'
ArtifactName: 'CustomNuGet'
jobs:
- job: ${{ Parameters.Name }}
pool:
vmImage: 'vs2017-win2016'
demands: npm
steps:
- task: DotNetCoreCLI@2
displayName: DotNet Restore
inputs:
command: restore
feedsToUse: config
nugetConfigPath: '${{ Parameters.WorkingDirectory }}/nuget.config'
projects: ${{ Parameters.RestoreBuildProjects }}
- task: DotNetCoreCLI@2
displayName: DotNet Build
inputs:
command: build
projects: ${{ Parameters.RestoreBuildProjects }}
arguments: '--configuration ${{ Parameters.BuildConfiguration }}'
workingDirectory: ${{ Parameters.WorkingDirectory }}
- powershell: |
$Package_CI_Version = "1.0.$(Build.BuildNumber)"
Write-Host ("##vso[task.setvariable variable=Package_CI_Version;]$Package_CI_Version")
displayName: 'Update Version'
- task: DotNetCoreCLI@2
displayName: 'DotNet Pack'
inputs:
command: pack
packagesToPack: '${{ Parameters.RestoreBuildProjects }}'
configuration: '$(BuildConfiguration)'
packDirectory: '$(Build.ArtifactStagingDirectory)'
nobuild: true
versioningScheme: 'byEnvVar'
versionEnvVar: 'Package_CI_Version'
majorVersion: '${{ Parameters.Major }}'
minorVersion: '${{ Parameters.Minor }}'
patchVersion: '$(Build.BuildNumber)'
# - task: NuGetCommand@2
# displayName: 'NuGet push'
# inputs:
# command: push
# packagesToPush: '**/Contoso.CognitivePipeline.ClientSDK.*.nupkg;**/Contoso.CognitivePipeline.ClientSDK.*.symbols.nupkg'
# publishVstsFeed: '$(azureArtifactFeedId)'
# allowPackageConflicts: true
- task: PublishBuildArtifacts@1
displayName: 'Publish NuGet Artifact: ${{ Parameters.Name }}'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: '${{ Parameters.ArtifactName }}'