@@ -12,140 +12,171 @@ resources:
12
12
type : github
13
13
name : nanoframework/nf-tools
14
14
endpoint : nfbot
15
-
16
- jobs :
17
-
18
- # ######################
19
- - job : Build_Class_Lib
20
- pool :
21
- vmImage : ' VS2017-Win2016'
22
-
23
- variables :
24
- solution : ' **/source/*.sln'
25
- buildPlatform : ' Any CPU'
26
- buildConfiguration : ' Release'
27
- nugetPackageName : ' nanoFramework.Networking.Sntp'
28
-
29
- steps :
30
-
31
- # need this here in order to persist GitHub credentials
32
- - checkout : self
33
- persistCredentials : true
34
-
35
- - task : NuGetToolInstaller@0
36
-
37
- - task : NuGetCommand@2
38
- inputs :
39
- restoreSolution : ' $(solution)'
40
- feedsToUse : config
41
- nugetConfigPath : source/NuGet.config
42
-
43
- - template : azure-pipelines-templates/nb-gitversioning-class-lib.yml@templates
44
-
45
- - task : InstallnFBuildComponents@1
46
- displayName : Install nanoFramework MSBuild components
47
-
48
- - task : VSBuild@1
49
- inputs :
50
- solution : ' $(solution)'
51
- platform : ' $(buildPlatform)'
52
- configuration : ' $(buildConfiguration)'
53
-
54
- # we don't have tests (yet)
55
- # - task: VSTest@2
56
- # inputs:
57
- # platform: '$(buildPlatform)'
58
- # configuration: '$(buildConfiguration)'
59
-
60
- - task : NuGetCommand@2
61
- inputs :
62
- command : ' custom'
63
- arguments : ' pack source\$(nugetPackageName).nuspec -Version $(NBGV_Version)'
64
- displayName : Pack NuGet with class library
65
-
66
- # - task: NuGetCommand@2
67
- # inputs:
68
- # command: 'custom'
69
- # arguments: 'pack source\$(nugetPackageName).DELIVERABLES.nuspec -Version $(NBGV_Version)'
70
- # displayName: Pack NuGet with build deliverables class library
71
-
72
- - task : CopyFiles@1
73
- inputs :
74
- sourceFolder : $(Build.SourcesDirectory)
75
- Contents : |
76
- **\$(nugetPackageName)*.nupkg
77
- TargetFolder : ' $(Build.ArtifactStagingDirectory)'
78
- flattenFolders : true
79
- condition : and( succeeded(), ne(variables['Build.Reason'], 'PullRequest') )
80
- displayName : Collecting deployable artifacts
81
-
82
- - task : PublishBuildArtifacts@1
83
- inputs :
84
- PathtoPublish : ' $(Build.ArtifactStagingDirectory)'
85
- ArtifactName : deployables
86
- ArtifactType : Container
87
- condition : and( succeeded(), ne(variables['Build.Reason'], 'PullRequest') )
88
- displayName : Publish deployables artifacts
89
-
90
- # push NuGet packages to MyGet feed (always happens except on PR builds)
91
- - task : NuGetCommand@2
92
- inputs :
93
- command : push
94
- nuGetFeedType : external
95
- packagesToPush : ' $(Build.ArtifactStagingDirectory)/*.nupkg;!$(Build.ArtifactStagingDirectory)/*.symbols.nupkg'
96
- publishFeedCredentials : ' MyGet'
97
- condition : and( succeeded(), ne(variables['Build.Reason'], 'PullRequest') )
98
- displayName : Push NuGet packages to MyGet
99
-
100
- # push NuGet class lib package to NuGet (happens on tag builds for any branch)
101
- - task : NuGetCommand@2
102
- inputs :
103
- command : push
104
- nuGetFeedType : external
105
- packagesToPush : ' $(Build.ArtifactStagingDirectory)/$(nugetPackageName).nupkg;!$(Build.ArtifactStagingDirectory)/$(nugetPackageName).symbols.nupkg'
106
- publishFeedCredentials : ' NuGet'
107
- condition : and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), contains(variables['Build.SourceBranchName'], 'tags') )
108
- displayName : Push NuGet packages to NuGet
109
-
110
- - task : UseRubyVersion@0
111
- inputs :
112
- versionSpec : ' >= 2.4'
113
- addToPath : true
114
- condition : and( succeeded(), ne(variables['Build.Reason'], 'PullRequest') )
115
- displayName : Setup Ruby
116
-
117
- # generate change log including future version
118
- - script : |
119
- gem install github_changelog_generator
120
- bundle exec github_changelog_generator --token $(GitHubToken) --future-release "v$(NBGV_Version)"
121
- condition: and( succeeded(), or( eq(variables['Build.SourceBranchName'], 'master'), contains(variables['Build.SourceBranchName'], 'release') ) )
122
- displayName: Generate change log
123
-
124
- # generate change log including future version
125
- - script : |
126
- gem install github_changelog_generator
127
- bundle exec github_changelog_generator --token $(GitHubToken)
128
- condition: and( succeeded(), not( or( eq(variables['Build.SourceBranchName'], 'master'), contains(variables['Build.SourceBranchName'], 'release') ) ) )
129
- displayName: Generate change log
130
-
131
- # #################################
132
- # report build failure to Discord
133
- - job : Report_Build_Failure
134
- dependsOn :
135
- - Build_Class_Lib
136
- condition : failed('Build_Class_Lib')
137
-
138
- pool :
139
- vmImage : ' VS2017-Win2016'
140
-
141
- steps :
142
-
143
- - checkout : self
144
- fetchDepth : 1
145
-
146
- # step from template @ nf-tools repo
147
- - template : azure-pipelines-templates/discord-webhook.yml@templates
148
- parameters :
149
- status : ' failure'
150
- webhookUrl : ' $(DiscordWebhook)'
151
- message : ' '
15
+ pool :
16
+ vmImage : ' VS2017-Win2016'
17
+
18
+ variables :
19
+ solution : ' **/source/*.sln'
20
+ buildPlatform : ' Any CPU'
21
+ buildConfiguration : ' Release'
22
+ nugetPackageName : ' nanoFramework.Networking.Sntp'
23
+
24
+ steps :
25
+
26
+ # need this here in order to persist GitHub credentials
27
+ - checkout : self
28
+ persistCredentials : true
29
+
30
+ - script : |
31
+ git config --global user.email "[email protected] "
32
+ git config --global user.name "nfbot"
33
+ displayName : Setup git identity
34
+
35
+ - task : NuGetToolInstaller@0
36
+
37
+ - task : NuGetCommand@2
38
+ inputs :
39
+ restoreSolution : ' $(solution)'
40
+ feedsToUse : config
41
+ nugetConfigPath : source/NuGet.config
42
+
43
+ - task : InstallnFBuildComponents@1
44
+ displayName : Install nanoFramework MSBuild components
45
+
46
+ - task : VSBuild@1
47
+ inputs :
48
+ solution : ' $(solution)'
49
+ platform : ' $(buildPlatform)'
50
+ configuration : ' $(buildConfiguration)'
51
+
52
+ # we don't have tests (yet)
53
+ # - task: VSTest@2
54
+ # inputs:
55
+ # platform: '$(buildPlatform)'
56
+ # configuration: '$(buildConfiguration)'
57
+
58
+ - task : PowerShell@2
59
+ inputs :
60
+ targetType : ' inline'
61
+ script : |
62
+ $MyNuGetVersion = $env:NBGV_NuGetPackageVersion -replace "\-g$env:NBGV_GitCommitIdShort", " "
63
+
64
+ # replace preview with alpha if this is a PR build
65
+ if($env:Build_Reason -eq 'PullRequest')
66
+ {
67
+ $MyNuGetVersion = $MyNuGetVersion -replace "preview", "alpha"
68
+ }
69
+
70
+ Write-Host "NuGet build number is $MyNuGetVersion"
71
+
72
+ Write-Host "$("##vso[task.setvariable variable=MY_NUGET_VERSION]")$MyNuGetVersion"
73
+ condition : succeeded()
74
+ displayName : Get NuGet build number
75
+
76
+ - task : UseRubyVersion@0
77
+ inputs :
78
+ versionSpec : ' >= 2.4'
79
+ addToPath : true
80
+ condition : and( succeeded(), ne(variables['Build.Reason'], 'PullRequest') )
81
+ displayName : Setup Ruby
82
+
83
+ # generate change log including future version
84
+ - powershell : |
85
+ gem install github_changelog_generator --quiet --no-ri --no-rdoc
86
+ # need to call it passing both cache options with full path otherwise it won't work
87
+ github_changelog_generator --token $(GitHubToken) --cache-log $env:AGENT_TEMPDIRECTORY\github-changelog-logger.log --cache-file $env:AGENT_TEMPDIRECTORY\github-changelog-http-cache
88
+ condition : and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), or( eq(variables['Build.SourceBranchName'], 'master'), contains(variables['Build.SourceBranchName'], 'release') ) )
89
+ displayName : Generate change log
90
+
91
+ # generate change log including future version
92
+ - powershell : |
93
+ gem install github_changelog_generator --quiet --no-ri --no-rdoc
94
+ # need to call it passing both cache options with full path otherwise it won't work
95
+ 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$env:MY_NUGET_VERSION
96
+ condition : and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), not( or( eq(variables['Build.SourceBranchName'], 'master'), contains(variables['Build.SourceBranchName'], 'release') ) ) )
97
+ displayName : Generate change log
98
+
99
+ # copy change log to artifacts directory
100
+ - task : CopyFiles@2
101
+ inputs :
102
+ SourceFolder : ' $(System.DefaultWorkingDirectory)'
103
+ Contents : ' CHANGELOG.md'
104
+ TargetFolder : ' $(Build.ArtifactStagingDirectory)'
105
+ condition : and( succeeded(), ne(variables['Build.Reason'], 'PullRequest') )
106
+ displayName : Copy Changelog
107
+
108
+ # push new changelog to GitHub repo
109
+ - powershell : |
110
+ git add CHANGELOG.md
111
+ git commit -m "Update CHANGELOG for v$env:NBGV_Version"
112
+ # need to wrap the git command bellow so it doesn't throw an error because of redirecting the output to stderr
113
+ git push origin "HEAD:$env:Build_SourceBranchName" --porcelain
114
+ condition : and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), not( contains(variables['Build.SourceBranchName'], 'tags') ) )
115
+ displayName : Push changelog to GitHub
116
+
117
+ # update could build number (only possible if this is not a PR from a fork)
118
+ - task : PowerShell@2
119
+ inputs :
120
+ targetType : ' inline'
121
+ script : Write-Host "$("##vso[build.updatebuildnumber]")$env:NBGV_NuGetPackageVersion"
122
+ condition : and( succeeded(), ne(variables['system.pullrequest.isfork'], true) )
123
+ displayName : Update cloud build number
124
+
125
+ - task : NuGetCommand@2
126
+ inputs :
127
+ command : ' custom'
128
+ arguments : ' pack source\$(nugetPackageName).nuspec -Version $(MY_NUGET_VERSION) -Symbols'
129
+ condition : succeeded()
130
+ displayName : Pack NuGet with class library
131
+
132
+ # - task: NuGetCommand@2
133
+ # inputs:
134
+ # command: 'custom'
135
+ # arguments: 'pack source\$(nugetPackageName).DELIVERABLES.nuspec -Version $(MY_NUGET_VERSION) -Symbols'
136
+ # displayName: Pack NuGet with build deliverables class library
137
+
138
+ - task : CopyFiles@1
139
+ inputs :
140
+ sourceFolder : $(Build.SourcesDirectory)
141
+ Contents : |
142
+ **\$(nugetPackageName)*.nupkg
143
+ TargetFolder : ' $(Build.ArtifactStagingDirectory)'
144
+ flattenFolders : true
145
+ condition : succeeded()
146
+ displayName : Collecting deployable artifacts
147
+
148
+ # publish artifacts (only possible if this is not a PR originated on a fork)
149
+ - task : PublishBuildArtifacts@1
150
+ inputs :
151
+ PathtoPublish : ' $(Build.ArtifactStagingDirectory)'
152
+ ArtifactName : deployables
153
+ ArtifactType : Container
154
+ condition : and( succeeded(), ne(variables['system.pullrequest.isfork'], true) )
155
+ displayName : Publish deployables artifacts
156
+
157
+ # push NuGet packages to MyGet feed (always happens except on PR builds)
158
+ - task : NuGetCommand@2
159
+ inputs :
160
+ command : push
161
+ nuGetFeedType : external
162
+ packagesToPush : ' $(Build.ArtifactStagingDirectory)/*.nupkg;!$(Build.ArtifactStagingDirectory)/*.symbols.nupkg'
163
+ publishFeedCredentials : ' MyGet'
164
+ condition : succeeded()
165
+ displayName : Push NuGet packages to MyGet
166
+
167
+ # push NuGet class lib package to NuGet (happens on tag builds for any branch)
168
+ - task : NuGetCommand@2
169
+ inputs :
170
+ command : push
171
+ nuGetFeedType : external
172
+ packagesToPush : ' $(Build.ArtifactStagingDirectory)/$(nugetPackageName).nupkg;!$(Build.ArtifactStagingDirectory)/$(nugetPackageName).symbols.nupkg'
173
+ publishFeedCredentials : ' NuGet'
174
+ condition : and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), contains(variables['Build.SourceBranchName'], 'tags') )
175
+ displayName : Push NuGet packages to NuGet
176
+
177
+ # step from template @ nf-tools repo
178
+ # update assembly declaration in nf-interpreter
179
+ - template : azure-pipelines-templates/update-assembly-declarations.yml@templates
180
+
181
+ # step from template @ nf-tools repo
182
+ - template : azure-pipelines-templates/discord-webhook-task.yml@templates
0 commit comments