@@ -10,10 +10,10 @@ variables:
1010 buildConfiguration : " Release"
1111 majorVersion : 1
1212 minorVersion : 0
13- patchVersion : $[counter(variables['minorVersion'], 0)]
13+ patchVersion : $[counter(format('{0}.{1}', variables['majorVersion'], variables[' minorVersion']) , 0)]
1414 version : $(majorVersion).$(minorVersion).$(patchVersion)
1515
16- name : $(majorVersion).$(minorVersion).$(patchVersion )
16+ name : $(version )
1717
1818steps :
1919 - task : UseDotNet@2
@@ -22,35 +22,41 @@ steps:
2222 version : " 8.0.x"
2323
2424 - task : DotNetCoreCLI@2
25+ displayName : ' Restore packages'
2526 inputs :
2627 command : ' restore'
2728 projects : ' $(solution)'
2829
2930 - task : DotNetCoreCLI@2
31+ displayName : ' Build solution'
3032 inputs :
3133 command : ' build'
3234 projects : ' $(solution)'
33- arguments : ' --configuration $(buildConfiguration)'
35+ arguments : ' --configuration $(buildConfiguration) --no-restore'
36+
37+ # TODO: Add test execution here
3438
3539 - task : DotNetCoreCLI@2
40+ displayName : ' Pack NuGet package'
3641 inputs :
3742 command : " pack"
3843 packagesToPack : " Htmx.Components.csproj"
3944 versioningScheme : " byBuildNumber"
4045 configuration : " $(buildConfiguration)"
4146
4247 - task : PublishBuildArtifacts@1
48+ displayName : ' Publish artifacts'
4349 inputs :
4450 PathtoPublish : " $(Build.ArtifactStagingDirectory)"
4551 ArtifactName : " drop"
4652 publishLocation : " Container"
4753
48- - script : |
49- dotnet nuget push "$(Build.ArtifactStagingDirectory)/**/*.nupkg" \
50- --api-key "$(NUGET_API_KEY)" \
51- --source "https://api.nuget.org/v3/index.json" \
52- --skip-duplicate
54+ - task : DotNetCoreCLI@2
55+ displayName : ' Push to NuGet.org'
5356 condition : and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
54- displayName: 'Push NuGet package to NuGet.org'
57+ inputs :
58+ command : ' custom'
59+ custom : ' nuget'
60+ arguments : ' push $(Build.ArtifactStagingDirectory)/**/*.nupkg --api-key $(NUGET_API_KEY) --source https://api.nuget.org/v3/index.json --skip-duplicate'
5561 env :
56- NUGET_API_KEY: $(NUGET_API_KEY )
62+ NUGET_API_KEY : $(NuGetApiKey )
0 commit comments