forked from nanoframework/nf-Visual-Studio-extension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
595 lines (507 loc) · 25.5 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
trigger:
branches:
include:
- master
- develop
- release/*
- refs/tags/*
paths:
exclude:
- CHANGELOG.md
- /*.md
- .gitignore
- appveyor.yml
# waiting for feature to become available
# tags:
# include:
# - v/*
pr:
branches:
include:
- master
- develop
- release/*
autoCancel: true
# add nf-tools repo to resources (for Azure Pipelines templates)
resources:
repositories:
- repository: templates
type: github
name: nanoframework/nf-tools
endpoint: nanoframework
jobs:
##############################
- job: Get_Build_Options
pool:
vmImage: 'VS2017-Win2016'
steps:
- checkout: self
# check which project(s) have changed
- powershell: |
git config --global user.email "nfbot"
git config --global user.name "nanoframework@outlook.com"
$auth = "basic $([System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes(":$(GitHubToken)"))))"
$commit = Invoke-RestMethod -Uri "https://api.github.com/repos/nanoframework/nf-Visual-Studio-extension/commits/$(Build.SourceVersion)" -Header @{"Authorization"="$auth"} -ContentType "application/json" -Method GET
Write-host "Files changed:"
$commit.files | % {$_.filename}
if( ($commit.files.filename -like "*source/CSharp.AssemblyInfoTemplate*") -Or
($commit.files.filename -like "*source/CSharp.BlankApplication*") -Or
($commit.files.filename -like "*source/CSharp.ClassLibrary*") -Or
($commit.files.filename -like "*source/CSharp.ClassTemplate*") -Or
($commit.files.filename -like "*source/CSharp.ResourceTemplate*") -Or
($commit.files.filename -like "*source/Tools.BuildTasks*") -Or
($commit.files.filename -like "*source/Tools.BuildTasks-2019*") -Or
($commit.files.filename -like "*source/Tools.CorHelper*") -Or
($commit.files.filename -like "*source/Tools.MetaDataProcessor*") -Or
($commit.files.filename -like "*source/Tools.Parser*")
)
{
# global changes, build both
echo "##vso[task.setvariable variable=BUILD_VS2017;isOutput=true]true"
echo "##vso[task.setvariable variable=BUILD_VS2019;isOutput=true]true"
}
else
{
if( $commit.files.filename -like "*source/nanoFramework.Tools.VisualStudio.sln")
{
# changes here impact VS2017
echo "##vso[task.setvariable variable=BUILD_VS2017;isOutput=true]true"
}
if( $commit.files.filename -like "*source/nanoFramework.Tools.VisualStudio-2019.sln")
{
# changes here impact VS2019
echo "##vso[task.setvariable variable=BUILD_VS2019;isOutput=true]true"
}
if( $commit.files.filename -like "*source/VisualStudio.Extension*" )
{
# changes here, most likely impact VS2019 too
echo "##vso[task.setvariable variable=BUILD_VS2017;isOutput=true]true"
echo "##vso[task.setvariable variable=BUILD_VS2019;isOutput=true]true"
}
if( $commit.files.filename -like "*source/VisualStudio.Extension-2019*" )
{
# changes here only impact VS2019
echo "##vso[task.setvariable variable=BUILD_VS2019;isOutput=true]true"
}
}
name: BuildOptions
displayName: get list of changed paths
######################
- job: VS2017
condition: or( eq( dependencies.Get_Build_Options.outputs['BuildOptions.BUILD_VS2017'], true ), eq(variables['BUILD_VS2017'], 'true') )
dependsOn:
- Get_Build_Options
pool:
vmImage: 'VS2017-Win2016'
variables:
solution: '**/source/nanoFramework.Tools.VisualStudio.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
# need this here in order to persist GitHub credentials AND init submodules
- checkout: self
submodules: true
- script: |
git config --global user.email 'nanoframework@outlook.com'
git config --global user.name 'nfbot'
displayName: Setup git identity
- task: NuGetToolInstaller@0
inputs:
versionSpec: '4.9.3'
displayName: 'Install specifc version of NuGet'
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
feedsToUse: config
nugetConfigPath: source/NuGet.config
verbosityRestore: quiet
- task: VSBuild@1
inputs:
solution: '$(solution)'
platform: '$(buildPlatform)'
msbuildArgs: '/p:PublicRelease=true'
configuration: '$(buildConfiguration)'
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
Write-Host "VS2017 build version $env:NBGV_AssemblyVersion"
echo "##vso[task.setvariable variable=BUILD_VERSION;isOutput=true]$env:NBGV_AssemblyVersion"
condition: succeeded()
name: VS2017Build
displayName: Store VS2017 build version
#####
# can't update could build number with release number because it's shared among VS2017 and VS2019
#####
# we don't have tests (yet)
# - task: VSTest@2
# inputs:
# platform: '$(buildPlatform)'
# configuration: '$(buildConfiguration)'
- task: CopyFiles@1
inputs:
sourceFolder: $(Build.SourcesDirectory)
Contents: |
**\*.vsix
**\vs2017-extension-manifest.json
**\vs2017-marketplace-overview.md
**\vs2017\debug-session.png
**\vs2017\starting-new-project.png
TargetFolder: '$(Build.ArtifactStagingDirectory)'
flattenFolders: true
condition: succeeded()
displayName: Collecting deployable artifacts
# publish artifacts (only possible if this is not a PR originated on a fork)
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: deployables
ArtifactType: Container
condition: and( succeeded(), ne(variables['system.pullrequest.isfork'], true) )
displayName: Publish deployables artifacts
# upload extension to Open VSIX Gallery (only possible if this is not a PR from a fork)
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
$artifactsSearchPattern = "./*.vsix"
$artifactsCollection = (Get-ChildItem $artifactsSearchPattern -Recurse)
(new-object Net.WebClient).DownloadString("https://raw.github.com/madskristensen/ExtensionScripts/master/AppVeyor/vsix.ps1") | iex
foreach($file in $artifactsCollection)
{
"Uploading VSIX package to Open VSIX Gallery..." | Write-Host
Vsix-PublishToGallery $file
}
condition: and( succeeded(), ne(variables['system.pullrequest.isfork'], true), not( startsWith(variables['Build.SourceBranch'], 'refs/pull') ) )
displayName: Upload vsix to Open VSIX Gallery
- powershell: |
# get subject and commit message for commit
$commitMessage = git log --format='%B' -1
# need to flatten message by removing new lines
$commitMessage = $commitMessage -replace "`r`n", " "
if($commitMessage -like "*PUBLISH_RELEASE*")
{
# set variable
Write-Host "$("##vso[task.setvariable variable=RELEASE_DRAFT]")false"
Write-Host "Release draft: FALSE"
}
else
{
# set variable
Write-Host "$("##vso[task.setvariable variable=RELEASE_DRAFT]")true"
Write-Host "Release draft: TRUE"
}
displayName: set release draft var
# create or update GitHub release
- task: GitHubReleasePublish@1
inputs:
githubEndpoint: 'nanoframework'
githubOwner: 'nanoframework'
githubRepositoryName: 'nf-Visual-Studio-extension'
githubTag: v$(NBGV_AssemblyVersion)-VS2017
githubReleaseTitle: 'nanoFramework VS2017 Extension v$(NBGV_AssemblyVersion)'
githubReleaseNotes: 'Check the [changelog](https://github.com/nanoframework/nf-Visual-Studio-extension/blob/$(Build.SourceBranchName)/CHANGELOG-VS2017.md).<br><br><h4>Install from nanoFramework Open VSIX Gallery development feed</h4><br>The following Visual Studio Extensions are available for install from this release<br><br>:package: [nanoFramework VS2017 Extension](http://vsixgallery.com/extension/47973986-ed3c-4b64-ba40-a9da73b44ef7)'
githubTargetCommitsh: $(Build.SourceVersion)
githubReleaseDraft: $(RELEASE_DRAFT)
githubReleasePrerelease: true
githubReuseDraftOnly: true
githubReuseRelease: true
githubEditRelease: true
githubDeleteEmptyTag: true
githubReleaseAsset: '$(Build.ArtifactStagingDirectory)/*.vsix'
condition: and( succeeded(), not( startsWith(variables['Build.SourceBranch'], 'refs/pull') ), not( startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ) )
displayName: Create/Update GitHub release
# create or update GitHub release ON tags from release or master branches
- task: GitHubReleasePublish@1
inputs:
githubEndpoint: 'nanoframework'
githubOwner: 'nanoframework'
githubRepositoryName: 'nf-Visual-Studio-extension'
githubTag: v$(NBGV_AssemblyVersion)-VS2017
githubReleaseTitle: 'nanoFramework VS2017 Extension v$(NBGV_AssemblyVersion)'
githubReleaseNotes: 'Check the [changelog](https://github.com/nanoframework/nf-Visual-Studio-extension/blob/$(Build.SourceBranchName)/CHANGELOG-VS2017.md).<br><br><h4>Install from Visual Studio Marketplace</h4><br>The following Visual Studio Extensions are available for install from this release<br>:package: [nanoFramework VS2017 Extension](https://marketplace.visualstudio.com/items?itemName=vs-publisher-1470366.nanoFrameworkVS2017Extension)'
githubTargetCommitsh: $(Build.SourceVersion)
githubReleaseDraft: false
githubReleasePrerelease: false
githubReuseDraftOnly: false
githubReuseRelease: false
githubEditRelease: false
githubDeleteEmptyTag: true
githubReleaseAsset: '$(Build.ArtifactStagingDirectory)/*.vsix'
condition: and( succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), contains(variables['Build.SourceBranch'], 'vs2017'), or( eq(variables['Build.SourceBranchName'], 'master'), contains(variables['Build.SourceBranchName'], 'release') ) )
displayName: Create/Update GitHub release VS2017 only
######################
- job: VS2019
condition: or( eq( dependencies.Get_Build_Options.outputs['BuildOptions.BUILD_VS2019'], true ), eq(variables['BUILD_VS2019'], 'true') )
dependsOn:
- Get_Build_Options
pool:
vmImage: 'windows-2019'
variables:
solution: '**/source/nanoFramework.Tools.VisualStudio-2019.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
# need this here in order to persist GitHub credentials AND init submodules
- checkout: self
submodules: true
- script: |
git config --global user.email 'nanoframework@outlook.com'
git config --global user.name 'nfbot'
displayName: Setup git identity
- task: NuGetToolInstaller@0
inputs:
versionSpec: '4.9.3'
displayName: 'Install specifc version of NuGet'
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
feedsToUse: config
nugetConfigPath: source/NuGet.config
verbosityRestore: quiet
- task: VSBuild@1
inputs:
solution: '$(solution)'
platform: '$(buildPlatform)'
msbuildArgs: '/p:PublicRelease=true'
configuration: '$(buildConfiguration)'
# we don't have tests (yet)
# - task: VSTest@2
# inputs:
# platform: '$(buildPlatform)'
# configuration: '$(buildConfiguration)'
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
Write-Host "VS2019 build version $env:NBGV_AssemblyVersion"
echo "##vso[task.setvariable variable=BUILD_VERSION;isOutput=true]$env:NBGV_AssemblyVersion"
condition: succeeded()
name: VS2019Build
displayName: Store VS2019 build version
#####
# can't update could build number with release number because it's shared among VS2017 and VS2019
#####
- task: CopyFiles@1
inputs:
sourceFolder: $(Build.SourcesDirectory)
Contents: |
**\*.vsix
**\vs2019-extension-manifest.json
**\vs2019-marketplace-overview.md
**\vs2019\debug-session.png
**\vs2019\starting-new-project.png
TargetFolder: '$(Build.ArtifactStagingDirectory)'
flattenFolders: true
condition: succeeded()
displayName: Collecting deployable artifacts
# publish artifacts (only possible if this is not a PR originated on a fork)
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: deployables
ArtifactType: Container
condition: and( succeeded(), ne(variables['system.pullrequest.isfork'], true) )
displayName: Publish deployables artifacts
# upload extension to Open VSIX Gallery (only possible if this is not a PR from a fork)
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
$artifactsSearchPattern = "./*.vsix"
$artifactsCollection = (Get-ChildItem $artifactsSearchPattern -Recurse)
(new-object Net.WebClient).DownloadString("https://raw.github.com/madskristensen/ExtensionScripts/master/AppVeyor/vsix.ps1") | iex
foreach($file in $artifactsCollection)
{
"Uploading VSIX package to Open VSIX Gallery..." | Write-Host
Vsix-PublishToGallery $file
}
condition: and( succeeded(), ne(variables['system.pullrequest.isfork'], true), not( startsWith(variables['Build.SourceBranch'], 'refs/pull') ) )
displayName: Upload vsix to Open VSIX Gallery
- powershell: |
# get subject and commit message for commit
$commitMessage = git log --format='%B' -1
# need to flatten message by removing new lines
$commitMessage = $commitMessage -replace "`r`n", " "
if($commitMessage -like "*PUBLISH_RELEASE*")
{
# set variable
Write-Host "$("##vso[task.setvariable variable=RELEASE_DRAFT]")false"
Write-Host "Release draft: FALSE"
}
else
{
# set variable
Write-Host "$("##vso[task.setvariable variable=RELEASE_DRAFT]")true"
Write-Host "Release draft: TRUE"
}
displayName: set release draft var
# create or update GitHub release
- task: GitHubReleasePublish@1
inputs:
githubEndpoint: 'nanoframework'
githubOwner: 'nanoframework'
githubRepositoryName: 'nf-Visual-Studio-extension'
githubTag: v$(NBGV_AssemblyVersion)-VS2019
githubReleaseTitle: 'nanoFramework VS2019 Extension v$(NBGV_AssemblyVersion)'
githubReleaseNotes: 'Check the [changelog](https://github.com/nanoframework/nf-Visual-Studio-extension/blob/$(Build.SourceBranchName)/CHANGELOG-VS2019.md).<br><br><h4>Install from nanoFramework Open VSIX Gallery development feed</h4><br>The following Visual Studio Extensions are available for install from this release<br><br>:package: [nanoFramework VS2019 Extension](http://vsixgallery.com/extension/455f2be5-bb07-451e-b351-a9faf3018dc9)'
githubTargetCommitsh: $(Build.SourceVersion)
githubReleaseDraft: $(RELEASE_DRAFT)
githubReleasePrerelease: true
githubReuseDraftOnly: true
githubReuseRelease: true
githubEditRelease: true
githubDeleteEmptyTag: true
githubReleaseAsset: '$(Build.ArtifactStagingDirectory)/*.vsix'
condition: and( succeeded(), not( startsWith(variables['Build.SourceBranch'], 'refs/pull') ), not( startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ) )
displayName: Create/Update GitHub release
# create or update GitHub release ON tags from release or master branches
- task: GitHubReleasePublish@1
inputs:
githubEndpoint: 'nanoframework'
githubOwner: 'nanoframework'
githubRepositoryName: 'nf-Visual-Studio-extension'
githubTag: v$(NBGV_AssemblyVersion)-VS2019
githubReleaseTitle: 'nanoFramework VS2019 Extension v$(NBGV_AssemblyVersion)'
githubReleaseNotes: 'Check the [changelog](https://github.com/nanoframework/nf-Visual-Studio-extension/blob/$(Build.SourceBranchName)/CHANGELOG-VS2019.md).<br><br><h4>Install from Visual Studio Marketplace</h4><br>The following Visual Studio Extensions are available for install from this release<br>:package: [nanoFramework VS2019 Extension](https://marketplace.visualstudio.com/items?itemName=nanoframework.nanoFramework-VS2019-Extension)'
githubTargetCommitsh: $(Build.SourceVersion)
githubReleaseDraft: false
githubReleasePrerelease: false
githubReuseDraftOnly: false
githubReuseRelease: false
githubEditRelease: false
githubDeleteEmptyTag: true
githubReleaseAsset: '$(Build.ArtifactStagingDirectory)/*.vsix'
condition: and( succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), contains(variables['Build.SourceBranch'], 'vs2019'), or( eq(variables['Build.SourceBranchName'], 'master'), contains(variables['Build.SourceBranchName'], 'release') ) )
displayName: Create/Update GitHub release VS2019 only
##################################
# generate changelog
# - job: Generate_Changelog
# dependsOn:
# - Get_Build_Options
# - VS2017
# - VS2019
# condition: succeeded()
# variables:
# myBuildVS2017: $[ dependencies.Get_Build_Options.outputs['BuildOptions.BUILD_VS2017'] ]
# MY_VS2017_VERSION: $[ dependencies.VS2017.outputs['VS2017Build.BUILD_VERSION'] ]
# myBuildVS2019: $[ dependencies.Get_Build_Options.outputs['BuildOptions.BUILD_VS2019'] ]
# MY_VS2019_VERSION: $[ dependencies.VS2019.outputs['VS2019Build.BUILD_VERSION'] ]
# pool:
# vmImage: 'VS2017-Win2016'
# steps:
# - checkout: self
# fetchDepth: 10
# - script: |
# git config --global user.email 'nanoframework@outlook.com'
# git config --global user.name 'nfbot'
# displayName: Setup git identity
# - task: UseRubyVersion@0
# inputs:
# versionSpec: '= 2.5'
# addToPath: true
# condition: and( succeeded(), not( startsWith(variables['Build.SourceBranch'], 'refs/pull') ) )
# displayName: Setup Ruby
# # install github_changelog_generator
# - powershell: |
# gem install github_changelog_generator --quiet --no-ri --no-rdoc
# condition: succeeded()
# displayName: Install github_changelog_generator
# # generate VS2019 change log
# - powershell: |
# # need to call it passing both cache options with full path otherwise it won't work
# github_changelog_generator --token $(GitHubToken) --cache-log $env:AGENT_TEMPDIRECTORY\github-changelog-logger.log --cache-file $env:AGENT_TEMPDIRECTORY\github-changelog-http-cache --since-tag v1.1.0.101-VS2019 --output CHANGELOG-VS2019.md
# condition: and( succeeded(), not( startsWith(variables['Build.SourceBranch'], 'refs/pull') ), not( startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ), or( eq(variables['Build.SourceBranchName'], 'master'), contains(variables['Build.SourceBranchName'], 'release') ), or( eq( variables['myBuildVS2019'], true ), eq(variables['BUILD_VS2019'], 'true') ) )
# displayName: Generate VS2019 change log
# # generate VS2019 change log including future version
# - powershell: |
# # need to call it passing both cache options with full path otherwise it won't work
# github_changelog_generator --token $(GitHubToken) --cache-log $env:AGENT_TEMPDIRECTORY\github-changelog-logger.log --cache-file $env:AGENT_TEMPDIRECTORY\github-changelog-http-cache --since-tag v1.1.0.101-VS2019 --future-release v$(MY_VS2019_VERSION) --output CHANGELOG-VS2019.md
# condition: and( succeeded(), not( startsWith(variables['Build.SourceBranch'], 'refs/pull') ), not( startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ), not( or( eq(variables['Build.SourceBranchName'], 'master'), contains(variables['Build.SourceBranchName'], 'release') ) ), or( eq( variables['myBuildVS2019'], true ), eq(variables['BUILD_VS2019'], 'true') ) )
# displayName: Generate VS2019 change log
# # copy VS2019 change log to artifacts directory
# - task: CopyFiles@2
# inputs:
# SourceFolder: '$(System.DefaultWorkingDirectory)'
# Contents: 'CHANGELOG-VS2019.md'
# TargetFolder: '$(Build.ArtifactStagingDirectory)'
# condition: and( succeeded(), not( startsWith(variables['Build.SourceBranch'], 'refs/pull') ), not( startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ), or( eq( variables['myBuildVS2019'], true ), eq(variables['BUILD_VS2019'], 'true') ) )
# displayName: Copy Changelog
# # generate VS2017 change log
# - powershell: |
# # need to call it passing both cache options with full path otherwise it won't work
# github_changelog_generator --token $(GitHubToken) --cache-log $env:AGENT_TEMPDIRECTORY\github-changelog-logger.log --cache-file $env:AGENT_TEMPDIRECTORY\github-changelog-http-cache --output CHANGELOG-VS2017.md
# condition: and( succeeded(), not( startsWith(variables['Build.SourceBranch'], 'refs/pull') ), not( startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ), or( eq(variables['Build.SourceBranchName'], 'master'), contains(variables['Build.SourceBranchName'], 'release') ), or( eq( variables['myBuildVS2017'], true ), eq(variables['BUILD_VS2017'], 'true') ) )
# displayName: Generate VS2017 change log
# # generate VS2017 change log including future version
# - powershell: |
# # need to call it passing both cache options with full path otherwise it won't work
# github_changelog_generator --token $(GitHubToken) --cache-log $env:AGENT_TEMPDIRECTORY\github-changelog-logger.log --cache-file $env:AGENT_TEMPDIRECTORY\github-changelog-http-cache --future-release v$(MY_VS2017_VERSION) --output CHANGELOG-VS2017.md
# condition: and( succeeded(), not( startsWith(variables['Build.SourceBranch'], 'refs/pull') ), not( startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ), not( or( eq(variables['Build.SourceBranchName'], 'master'), contains(variables['Build.SourceBranchName'], 'release') ) ), or( eq( variables['myBuildVS2017'], true ), eq(variables['BUILD_VS2017'], 'true') ) )
# displayName: Generate VS2017 change log
# # copy VS2017 change log to artifacts directory
# - task: CopyFiles@2
# inputs:
# SourceFolder: '$(System.DefaultWorkingDirectory)'
# Contents: 'CHANGELOG-VS2017.md'
# TargetFolder: '$(Build.ArtifactStagingDirectory)'
# condition: and( succeeded(), not( startsWith(variables['Build.SourceBranch'], 'refs/pull') ), not( startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ), or( eq( variables['myBuildVS2017'], true ), eq(variables['BUILD_VS2017'], 'true') ) )
# displayName: Copy VS2017 Changelog
# # commit VS2017 changelog
# - task: PowerShell@2
# inputs:
# targetType: 'inline'
# script: |
# git add CHANGELOG-VS2017.md
# git commit -m "Update CHANGELOG for VS2017 v$env:MY_VS2017_VERSION" -m"***NO_CI***"
# condition: and( succeeded(), not( startsWith(variables['Build.SourceBranch'], 'refs/pull') ), not( startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ), or( eq( variables['myBuildVS2017'], true ), eq(variables['BUILD_VS2017'], 'true') ) )
# displayName: Commit VS2017 changelog
# - task: CopyFiles@1
# inputs:
# sourceFolder: $(Build.SourcesDirectory)
# Contents: |
# **\CHANGELOG-VS2017.md
# TargetFolder: '$(Build.ArtifactStagingDirectory)'
# flattenFolders: true
# condition: and( succeeded(), or( eq( variables['myBuildVS2017'], true ), eq(variables['BUILD_VS2017'], 'true') ) )
# displayName: Collecting VS2017 deployable artifacts
# - task: CopyFiles@1
# inputs:
# sourceFolder: $(Build.SourcesDirectory)
# Contents: |
# **\CHANGELOG-VS2017.md
# **\CHANGELOG-VS2019.md
# TargetFolder: '$(Build.ArtifactStagingDirectory)'
# flattenFolders: true
# condition: and( succeeded(), or( eq( variables['myBuildVS2019'], true ), eq(variables['BUILD_VS2019'], 'true') ) )
# displayName: Collecting deployable artifacts
# # publish artifacts (only possible if this is not a PR originated on a fork)
# - task: PublishBuildArtifacts@1
# inputs:
# PathtoPublish: '$(Build.ArtifactStagingDirectory)'
# ArtifactName: deployables
# ArtifactType: Container
# condition: and( succeeded(), ne(variables['system.pullrequest.isfork'], true) )
# displayName: Publish deployables artifacts
# # commit VS2019 changelog
# - task: PowerShell@2
# inputs:
# targetType: 'inline'
# script: |
# git add CHANGELOG-VS2019.md
# git commit -m "Update CHANGELOG for VS2019 v$env:MY_VS2019_VERSION" -m"***NO_CI***"
# condition: and( succeeded(), not( startsWith(variables['Build.SourceBranch'], 'refs/pull') ), not( startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ), or( eq( variables['myBuildVS2019'], true ), eq(variables['BUILD_VS2019'], 'true') ) )
# displayName: Commit VS2019 changelog
# # push changelogs to GitHub repo
# - task: PowerShell@2
# inputs:
# targetType: 'inline'
# script: |
# git config user.email 'nanoframework@outlook.com'
# git config user.name 'nfbot'
# # compute authorization header in format "AUTHORIZATION: basic 'encoded token'"
# # 'encoded token' is the Base64 of the string "nfbot:personal-token"
# $auth = "basic $([System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("nfbot:$(GitHubToken)"))))"
# git -c http.extraheader="AUTHORIZATION: $auth" push origin "HEAD:$(Build.SourceBranchName)"
# condition: and( succeeded(), not( startsWith(variables['Build.SourceBranch'], 'refs/pull') ), not( startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ) )
# displayName: Push changelogs to GitHub