7171
7272 # prepare release and capture output
7373 Write-Host "Prepare release with NBGV..."
74- $release = nbgv prepare-release -p source
74+ $release = nbgv prepare-release
7575
7676 Write-Host "Prepare commit..."
7777 # get commit message for the merge
@@ -121,7 +121,7 @@ jobs:
121121# ##########################################################
122122# build tool
123123- job : Build_tool
124- condition : not( eq( dependencies.Check_Build_Options.outputs['BuildOptions.SKIP_BUILD'], true ) )
124+ condition : ne( dependencies.Check_Build_Options.outputs['BuildOptions.SKIP_BUILD'], true )
125125 dependsOn :
126126 - Check_Build_Options
127127
@@ -146,35 +146,34 @@ jobs:
146146 displayName: Setup git identity
147147
148148 - task : NuGetToolInstaller@0
149- inputs :
150- versionSpec : ' 4.9.3'
151149 displayName : ' Install specifc version of NuGet'
150+ inputs :
151+ versionSpec : ' 5.4.0'
152152
153153 - task : UseDotNet@2
154+ displayName : Install .NET Core SDK
154155 inputs :
155156 packageType : sdk
156157 version : 3.1.101
157- displayName : Install .NET Core SDK
158158
159159 - task : DotNetCoreCLI@2
160+ displayName : Restore NuGet packages
160161 inputs :
161162 command : restore
162- verbosityRestore : minimal # detailed, normal, minimal
163- projects : source\ nanoFirmwareFlasher.sln
163+ verbosityRestore : minimal
164+ projects : nanoFirmwareFlasher.sln
164165 feedsToUse : config
165- nugetConfigPath : source/NuGet.Config
166- workingDirectory : source
167- displayName : Restore NuGet packages
166+ nugetConfigPath : NuGet.Config
168167
169168 - script : dotnet build -r win-x64 -c $(BuildConfiguration) /p:PublicRelease=true --no-restore /t:build,pack
170- workingDirectory : source
171169 displayName : Build NuGet package
172170
173171 - script : dotnet pack --runtime win-x64 -c $(BuildConfiguration) -p:PublicRelease=true -p:PackGlobalTool=true --no-restore
174- workingDirectory : source
175172 displayName : Build .NET Core Tool NuGet package
176173
177174 - task : PowerShell@2
175+ condition : succeeded()
176+ displayName : Get NuGet build number
178177 inputs :
179178 targetType : ' inline'
180179 script : |
@@ -189,16 +188,14 @@ jobs:
189188 Write-Host "NuGet build number is $MyNuGetVersion"
190189
191190 Write-Host "$("##vso[task.setvariable variable=MY_NUGET_VERSION]")$MyNuGetVersion"
192- condition : succeeded()
193- displayName : Get NuGet build number
194191
195192 # update could build number (only possible if this is not a PR from a fork)
196193 - task : PowerShell@2
194+ condition : and( succeeded(), ne(variables['system.pullrequest.isfork'], true) )
195+ displayName : Update cloud build number
197196 inputs :
198197 targetType : ' inline'
199198 script : Write-Host "$("##vso[build.updatebuildnumber]")$env:NBGV_NuGetPackageVersion"
200- condition : and( succeeded(), ne(variables['system.pullrequest.isfork'], true) )
201- displayName : Update cloud build number
202199
203200 - powershell : |
204201 # get subject and commit message for commit
@@ -223,49 +220,51 @@ jobs:
223220 displayName: set release draft var
224221
225222 - task : CopyFiles@1
223+ condition : succeeded()
224+ displayName : Collecting deployable artifacts
226225 inputs :
227226 sourceFolder : $(Build.SourcesDirectory)
228227 Contents : |
229228 **\*.nupkg
230229 TargetFolder : ' $(Build.ArtifactStagingDirectory)'
231230 flattenFolders : true
232- condition : succeeded()
233- displayName : Collecting deployable artifacts
234231
235232 # publish artifacts (only possible if this is not a PR originated on a fork)
236233 - task : PublishBuildArtifacts@1
234+ condition : and( succeeded(), ne(variables['system.pullrequest.isfork'], true) )
235+ displayName : Publish deployables artifacts
237236 inputs :
238237 PathtoPublish : ' $(Build.ArtifactStagingDirectory)'
239238 ArtifactName : deployables
240239 ArtifactType : Container
241- condition : and( succeeded(), ne(variables['system.pullrequest.isfork'], true) )
242- displayName : Publish deployables artifacts
243240
244241 # push NuGet packages to AzureArtifacts feed (always happens except on PR builds)
245242 - task : NuGetCommand@2
243+ condition : succeeded()
244+ displayName : Push NuGet packages to AzureArtifacts
245+ continueOnError : true
246246 inputs :
247247 command : push
248248 nuGetFeedType : external
249249 packagesToPush : ' $(Build.ArtifactStagingDirectory)/*.nupkg'
250250 publishFeedCredentials : ' AzureArtifacts-nanoFirmwareFlasher'
251- condition : succeeded()
252- continueOnError : true
253- displayName : Push NuGet packages to AzureArtifacts
254251
255252 # push NuGet class lib package to NuGet (happens on tag builds for any branch)
256253 - task : NuGetCommand@2
254+ condition : and( succeeded(), ne(variables['Build.Reason'], 'PullRequest') )
255+ displayName : Push NuGet packages to NuGet
256+ continueOnError : true
257257 inputs :
258258 command : push
259259 nuGetFeedType : external
260260 allowPackageConflicts : true
261261 packagesToPush : ' $(Build.ArtifactStagingDirectory)/*.nupkg'
262262 publishFeedCredentials : ' NuGet-nanoFirmwareFlasher'
263- condition : and( succeeded(), ne(variables['Build.Reason'], 'PullRequest') )
264- continueOnError : true
265- displayName : Push NuGet packages to NuGet
266263
267264 # create or update GitHub release ON tags from release or master branches
268265 - task : GitHubReleasePublish@1
266+ condition : and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), not( startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ) )
267+ displayName : Create/Update GitHub PREVIEW release
269268 inputs :
270269 githubEndpoint : ' nanoFramework'
271270 githubOwner : ' nanoframework'
@@ -281,11 +280,11 @@ jobs:
281280 githubEditRelease : true
282281 githubDeleteEmptyTag : true
283282 githubReleaseAsset : ' $(Build.ArtifactStagingDirectory)/*.nupkg'
284- condition : and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), not( startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ) )
285- displayName : Create/Update GitHub PREVIEW release
286283
287284 # create or update GitHub release ON tags from release or master branches
288285 - task : GitHubReleasePublish@1
286+ condition : and( succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), not(contains(variables['Build.SourceBranch'], 'preview') ) )
287+ displayName : Create/Update GitHub stable release
289288 inputs :
290289 githubEndpoint : ' nanoFramework'
291290 githubOwner : ' nanoframework'
@@ -301,8 +300,6 @@ jobs:
301300 githubEditRelease : false
302301 githubDeleteEmptyTag : true
303302 githubReleaseAsset : ' $(Build.ArtifactStagingDirectory)/$(nugetPackageName).$(MY_NUGET_VERSION).nupkg'
304- condition : and( succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), not(contains(variables['Build.SourceBranch'], 'preview') ) )
305- displayName : Create/Update GitHub stable release
306303
307304# #################################
308305# report build failure to Discord
0 commit comments