@@ -17,6 +17,10 @@ trigger:
1717 - assets/*
1818 - .github/*
1919
20+ tags :
21+ include :
22+ - v*
23+
2024# PR always trigger build
2125pr :
2226 autoCancel : true
@@ -29,87 +33,141 @@ resources:
2933 name : nanoframework/nf-tools
3034 endpoint : nanoframework
3135
32- pool :
33- vmImage : ' windows-latest'
34-
35- variables :
36- - group : sign-client-credentials
37- - name : DOTNET_NOLOGO
38- value : true
39- - name : buildPlatform
40- value : ' Any CPU'
41- - name : buildConfiguration
42- value : ' Release'
43- - name : nugetPackageName
44- value : ' nanoFramework.System.Net.Http'
45- - name : solution
46- value : ' nanoFramework.System.Net.Http.sln'
47-
48- steps :
49-
50- # step from template @ nf-tools repo
51- # build steps only
52- - template : azure-pipelines-templates/class-lib-build-only.yml@templates
53- parameters :
54- sonarCloudProject : ' nanoframework_lib-nanoFramework.System.Net.Http'
55- runUnitTests : false
56- unitTestRunsettings : ' $(System.DefaultWorkingDirectory)\Tests\HttpUnitTests\nano.runsettings'
57-
58- # package steps
59- - template : azure-pipelines-templates/class-lib-package.yml@templates
60- parameters :
61- nugetPackageName : ' nanoFramework.System.Net.Http'
62-
63- - template : azure-pipelines-templates/class-lib-package.yml@templates
64- parameters :
65- nugetPackageName : ' nanoFramework.System.Net.Http.Client'
66-
67- - template : azure-pipelines-templates/class-lib-package.yml@templates
68- parameters :
69- nugetPackageName : ' nanoFramework.System.Net.Http.Server'
70-
71- - template : azure-pipelines-templates/class-lib-publish.yml@templates
72-
73- # create GitHub release build from main branch
74- - task : GithubRelease@1
36+ jobs :
37+
38+ # #############################
39+ - job : Build_Library
7540 condition : >-
7641 and(
77- succeeded( ),
78- eq(variables['System.PullRequest.PullRequestId'], ''),
79- startsWith (variables['Build.SourceBranch '], 'refs/heads/main '),
80- not(contains( variables['Build.SourceBranch '], 'preview')),
81- eq(variables['StartReleaseCandidate'], false )
42+ not(startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ),
43+ or(
44+ eq (variables['UPDATE_DEPENDENTS '], 'false '),
45+ eq( variables['StartReleaseCandidate '], 'true')
46+ )
8247 )
83- displayName : Create/Update GitHub release
84- inputs :
85- action : edit
86- gitHubConnection : ' github.com_nano-$(System.TeamProject)'
87- tagSource : userSpecifiedTag
88- tag : v$(MY_NUGET_VERSION)
89- title : ' $(nugetPackageName) Library v$(MY_NUGET_VERSION)'
90- releaseNotesSource : inline
91- releaseNotesInline : ' Check the [changelog]($(Build.Repository.Uri)/blob/$(Build.SourceBranchName)/CHANGELOG.md).<br><br><h4>Install from NuGet</h4><br>The following NuGet packages are available for download from this release:<br>:package: [.NET](https://www.nuget.org/packages/$(nugetPackageName)/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION).<br>:package: [.NET (client API only)](https://www.nuget.org/packages/nanoFramework.System.Net.Http.Client/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION)<br>:package: [.NET (server API only)](https://www.nuget.org/packages/nanoFramework.System.Net.Http.Server/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION)'
92- assets : ' $(Build.ArtifactStagingDirectory)/*.nupkg'
93- assetUploadMode : replace
94- isPreRelease : false
95- addChangeLog : false
96-
97- # update dependents
98- - template : azure-pipelines-templates/update-dependents.yml@templates
99- parameters :
100- ${{ if eq(variables['UPDATE_DEPENDENTS'], 'true') }} :
48+ pool :
49+ vmImage : ' windows-latest'
50+
51+ variables :
52+ - group : sign-client-credentials
53+ - name : DOTNET_NOLOGO
54+ value : true
55+ - name : buildPlatform
56+ value : ' Any CPU'
57+ - name : buildConfiguration
58+ value : ' Release'
59+ - name : nugetPackageName
60+ value : ' nanoFramework.System.Net.Http'
61+ - name : solution
62+ value : ' nanoFramework.System.Net.Http.sln'
63+ steps :
64+
65+ # step from template @ nf-tools repo
66+ # build steps only
67+ - template : azure-pipelines-templates/class-lib-build-only.yml@templates
68+ parameters :
69+ sonarCloudProject : ' nanoframework_lib-nanoFramework.System.Net.Http'
70+ runUnitTests : false
71+ unitTestRunsettings : ' $(System.DefaultWorkingDirectory)\Tests\HttpUnitTests\nano.runsettings'
72+
73+ # package steps
74+ - template : azure-pipelines-templates/class-lib-package.yml@templates
75+ parameters :
76+ nugetPackageName : ' nanoFramework.System.Net.Http'
77+
78+ - template : azure-pipelines-templates/class-lib-package.yml@templates
79+ parameters :
80+ nugetPackageName : ' nanoFramework.System.Net.Http.Client'
81+
82+ - template : azure-pipelines-templates/class-lib-package.yml@templates
83+ parameters :
84+ nugetPackageName : ' nanoFramework.System.Net.Http.Server'
85+
86+ - template : azure-pipelines-templates/class-lib-publish.yml@templates
87+
88+ # create GitHub release build from main branch
89+ - task : GithubRelease@1
90+ condition : >-
91+ and(
92+ succeeded(),
93+ eq(variables['System.PullRequest.PullRequestId'], ''),
94+ startsWith(variables['Build.SourceBranch'], 'refs/heads/main'),
95+ not(contains(variables['Build.SourceBranch'], 'preview')),
96+ eq(variables['StartReleaseCandidate'], false)
97+ )
98+ displayName : Create/Update GitHub release
99+ inputs :
100+ action : edit
101+ gitHubConnection : ' github.com_nano-$(System.TeamProject)'
102+ tagSource : userSpecifiedTag
103+ tag : v$(MY_NUGET_VERSION)
104+ title : ' $(nugetPackageName) Library v$(MY_NUGET_VERSION)'
105+ releaseNotesSource : inline
106+ releaseNotesInline : ' Check the [changelog]($(Build.Repository.Uri)/blob/$(Build.SourceBranchName)/CHANGELOG.md).<br><br><h4>Install from NuGet</h4><br>The following NuGet packages are available for download from this release:<br>:package: [.NET](https://www.nuget.org/packages/$(nugetPackageName)/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION).<br>:package: [.NET (client API only)](https://www.nuget.org/packages/nanoFramework.System.Net.Http.Client/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION)<br>:package: [.NET (server API only)](https://www.nuget.org/packages/nanoFramework.System.Net.Http.Server/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION)'
107+ assets : ' $(Build.ArtifactStagingDirectory)/*.nupkg'
108+ assetUploadMode : replace
109+ isPreRelease : false
110+ addChangeLog : false
111+
112+ # #############################
113+ - job : Update_Dependents
114+ condition : >-
115+ or(
116+ and(
117+ startsWith(variables['Build.SourceBranch'], 'refs/tags/v'),
118+ eq(variables['StartReleaseCandidate'], 'false')
119+ ),
120+ and(
121+ contains(variables['getCommitMessage.COMMIT_MESSAGE'], '***UPDATE_DEPENDENTS***'),
122+ eq(variables['StartReleaseCandidate'], 'false')
123+ ),
124+ eq(variables['UPDATE_DEPENDENTS'], 'true')
125+ )
126+
127+ pool :
128+ vmImage : ' windows-latest'
129+
130+ variables :
131+ DOTNET_NOLOGO : true
132+
133+ steps :
134+ # need this here in order to persist GitHub credentials
135+ - checkout : self
136+ fetchDepth : 1
137+
138+ # update dependents
139+ - template : azure-pipelines-templates/update-dependents.yml@templates
140+ parameters :
101141 waitBeforeUpdate : false
102- ${{ else }} :
103- waitBeforeUpdate : true
104- repositoriesToUpdate : |
105- nanoFramework.WebServer
106- nanoFramework.Azure.Devices
107- System.Net.WebSockets
108-
109- # step from template @ nf-tools repo
110- # report error
111- - template : azure-pipelines-templates/discord-webhook-task.yml@templates
112- parameters :
113- status : ' failure'
114- webhookUrl : ' $(DiscordWebhook)'
115- message : ' '
142+ repositoriesToUpdate : |
143+ nanoFramework.WebServer
144+ nanoFramework.Azure.Devices
145+ System.Net.WebSockets
146+
147+ # #################################
148+ # report build failure to Discord
149+ - job : Report_Build_Failure
150+
151+ dependsOn :
152+ - Build_Library
153+ - Update_Dependents
154+ condition : >-
155+ or(
156+ failed('Build_Library'),
157+ failed('Update_Dependents')
158+ )
159+
160+ pool :
161+ vmImage : ' windows-latest'
162+
163+ steps :
164+
165+ - checkout : self
166+
167+ # step from template @ nf-tools repo
168+ # report error
169+ - template : azure-pipelines-templates/discord-webhook-task.yml@templates
170+ parameters :
171+ status : ' failure'
172+ webhookUrl : ' $(DiscordWebhook)'
173+ message : ' '
0 commit comments