@@ -7,73 +7,44 @@ trigger:
77- master
88variables :
99 buildConfiguration : ' Release'
10+ pool :
11+ vmImage : ' windows-latest'
1012
1113stages :
1214- stage : Build
13- displayName : " Build solution "
15+ displayName : " Build project "
1416 jobs :
1517 - job : BuildJob
1618 displayName : " Build job"
17- pool :
18- vmImage : ' Ubuntu 16.04'
1919 steps :
20- - script : dotnet restore
20+ - task : DotNetCoreCLI@2
2121 displayName : ' dotnet restore'
22- - script : dotnet build --configuration $(buildConfiguration)
23- displayName : ' dotnet build $(buildConfiguration)'
24- - stage : Tests
25- displayName : " Unit tests"
26- jobs :
27- - job : TestsJob
28- displayName : " Unit tests job"
29- pool :
30- vmImage : ' Ubuntu 16.04'
31- steps :
22+ inputs :
23+ command : restore
24+ projects : ' src\JsonAutoService\*.csproj'
3225 - task : DotNetCoreCLI@2
33- displayName : ' dotnet test $(buildConfiguration) '
26+ displayName : ' dotnet publish '
3427 inputs :
35- command : test
36- projects : ' **/*Tests/*.csproj'
37- arguments : ' --configuration $(buildConfiguration) --collect "Code coverage"'
28+ command : publish
29+ publishWebProjects : false
30+ projects : ' src\JsonAutoService\*.csproj'
31+ arguments : ' --configuration $(BuildConfiguration) --output $(build.artifactstagingdirectory)'
3832- stage : Publish
3933 displayName : " Publish nuget"
40- condition : and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
4134 jobs :
4235 - job : PublishJob
43- displayName : " Publish nuget job"
44- pool :
45- vmImage : ' Ubuntu 16.04'
36+ displayName : " Publish nuget to feeds"
4637 steps :
47- - task : PowerShell@2
48- displayName : ' Extract Package Version'
49- inputs :
50- targetType : filePath
51- filePath : ./ExtractPackageVersion.ps1
52- arguments : ' "JsonAutoService.csproj"'
53- - task : DotNetCoreCLI@2
54- displayName : ' dotnet publish'
55- inputs :
56- command : ' publish'
57- publishWebProjects : false
58- projects : ' **/*.csproj'
59- arguments : ' --configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)'
60- - task : DotNetCoreCLI@2
61- displayName : ' dotnet pack'
62- inputs :
63- command : ' pack'
64- packagesToPack : ' **/*.csproj'
65- versioningScheme : ' byEnvVar'
66- versionEnvVar : PackageVersion
67- - task : DotNetCoreCLI@2
68- displayName : ' nuget push'
38+ - task : NuGetCommand@2
39+ displayName : ' Push package to nuget.org'
6940 inputs :
70- command : ' push'
71- packagesToPush : ' $(Build.ArtifactStagingDirectory)/ *.nupkg'
72- nuGetFeedType : ' internal '
73- publishVstsFeed : ' 056601d6-dfaa-4347-b739-d744df6a7c63 '
74- - task : PublishBuildArtifacts@1
75- displayName : ' publish build artifacts '
41+ command : push
42+ packagesToPush : ' src\JsonAutoService\bin\Release\ *.nupkg'
43+ nuGetFeedType : external
44+ publishFeedCredentials : nuget.org
45+ - task : NuGetCommand@2
46+ displayName : ' Push package to internal feed '
7647 inputs :
77- PathtoPublish : ' $(Build.ArtifactStagingDirectory) '
78- ArtifactName : ' drop '
79- publishLocation : ' Container '
48+ command : push
49+ packagesToPush : ' src\JsonAutoService\bin\Release\*.nupkg '
50+ publishVstsFeed : ' 056601d6-dfaa-4347-b739-d744df6a7c63 '
0 commit comments