@@ -146,6 +146,28 @@ jobs:
146146 continueOnError : true
147147 displayName : Push NuGet packages to NuGet
148148
149+ - powershell : |
150+ # get subject and commit message for commit
151+ $commitMessage = git log --format='%B' -1
152+
153+ # need to flatten message by removing new lines
154+ $commitMessage = $commitMessage -replace "`r`n", " "
155+
156+ if($commitMessage -like "*PUBLISH_RELEASE*")
157+ {
158+ # set variable
159+ Write-Host "$("##vso[task.setvariable variable=RELEASE_DRAFT]")false"
160+ Write-Host "Release draft: FALSE"
161+ }
162+ else
163+ {
164+ # set variable
165+ Write-Host "$("##vso[task.setvariable variable=RELEASE_DRAFT]")true"
166+ Write-Host "Release draft: TRUE"
167+ }
168+
169+ displayName: set release draft var
170+
149171 # create or update GitHub release
150172 - task : GitHubReleasePublish@1
151173 inputs :
@@ -156,11 +178,12 @@ jobs:
156178 githubReleaseTitle : ' nano firmware flasher v$(MY_NUGET_VERSION)'
157179 githubReleaseNotes : ' add description here'
158180 githubTargetCommitsh : $(Build.SourceVersion)
159- githubReleaseDraft : true
160- githubReleasePrerelease : false
181+ githubReleaseDraft : $(RELEASE_DRAFT)
182+ githubReleasePrerelease : true
161183 githubReuseDraftOnly : true
162184 githubReuseRelease : true
163185 githubEditRelease : true
186+ githubDeleteEmptyTag : true
164187 githubReleaseAsset : ' $(Build.ArtifactStagingDirectory)/*.nupkg'
165188 condition : and( succeeded(), not( startsWith(variables['Build.SourceBranch'], 'refs/pull') ), not( startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ) )
166189 displayName : Create/Update GitHub release
@@ -175,33 +198,32 @@ jobs:
175198 githubReleaseTitle : ' nano firmware flasher v$(MY_NUGET_VERSION)'
176199 githubReleaseNotes : ' add description here'
177200 githubTargetCommitsh : $(Build.SourceVersion)
178- githubReleaseDraft : false
201+ githubReleaseDraft : $(RELEASE_DRAFT)
179202 githubReleasePrerelease : true
180203 githubReuseDraftOnly : false
181204 githubReuseRelease : true
182205 githubEditRelease : true
206+ githubDeleteEmptyTag : true
183207 githubReleaseAsset : ' $(Build.ArtifactStagingDirectory)/*.nupkg'
184208 condition : and( succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), contains(variables['Build.SourceBranch'], 'preview') )
185209 displayName : Create/Update GitHub PREVIEW release
186210
187- # #################################
188- # report build failure to Discord
189- - job : Report_Build_Failure
190- dependsOn :
191- - Build_tool
192- condition : failed('Build_tool')
193-
194- pool :
195- vmImage : ' VS2017-Win2016'
196-
197- steps :
198-
199- - checkout : self
200- fetchDepth : 1
201-
202- # step from template @ nf-tools repo
203- - template : azure-pipelines-templates/discord-webhook.yml@templates
204- parameters :
205- status : ' failure'
206- webhookUrl : ' $(DiscordWebhook)'
207- message : ' '
211+ # create or update GitHub release ON tags from release or master branches
212+ - task : GitHubReleasePublish@1
213+ inputs :
214+ githubEndpoint : ' nanoFramework'
215+ githubOwner : ' nanoframework'
216+ githubRepositoryName : ' nanoFirmwareFlasher '
217+ githubTag : v$(MY_NUGET_VERSION)
218+ githubReleaseTitle : ' nano firmware flasher v$(MY_NUGET_VERSION)'
219+ githubReleaseNotes : ' add description here'
220+ githubTargetCommitsh : $(Build.SourceVersion)
221+ githubReleaseDraft : false
222+ githubReleasePrerelease : false
223+ githubReuseDraftOnly : false
224+ githubReuseRelease : false
225+ githubEditRelease : false
226+ githubDeleteEmptyTag : true
227+ githubReleaseAsset : ' $(Build.ArtifactStagingDirectory)/$(nugetPackageName).$(MY_NUGET_VERSION).nupkg'
228+ condition : and( succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), not(contains(variables['Build.SourceBranch'], 'preview') ) )
229+ displayName : Create/Update GitHub stable release
0 commit comments