@@ -43,207 +43,12 @@ variables:
4343
4444steps :
4545
46- # need this here in order to persist GitHub credentials
47- - checkout : self
48- persistCredentials : true
49-
50- - script : |
51- git config --global user.email "nfbot@users.noreply.github.com"
52- git config --global user.name "nfbot"
53- displayName : Setup git identity
54-
55- - task : NuGetToolInstaller@0
56-
57- - task : NuGetCommand@2
58- inputs :
59- restoreSolution : ' $(solution)'
60- feedsToUse : config
61- nugetConfigPath : source/NuGet.config
62-
63- - task : InstallnFBuildComponents@1
64- displayName : Install nanoFramework MSBuild components
65-
66- - task : VSBuild@1
67- inputs :
68- solution : ' $(solution)'
69- platform : ' $(buildPlatform)'
70- configuration : ' $(buildConfiguration)'
71-
72- # we don't have tests (yet)
73- # - task: VSTest@2
74- # inputs:
75- # platform: '$(buildPlatform)'
76- # configuration: '$(buildConfiguration)'
77-
78- - task : PowerShell@2
79- inputs :
80- targetType : ' inline'
81- script : |
82- $MyNuGetVersion = $env:NBGV_NuGetPackageVersion -replace "\-g$env:NBGV_GitCommitIdShort", ""
83-
84- # replace preview with alpha if this is a PR build
85- if($env:Build_Reason -eq 'PullRequest')
86- {
87- $MyNuGetVersion = $MyNuGetVersion -replace "preview", "alpha"
88- }
89-
90- Write-Host "NuGet build number is $MyNuGetVersion"
91-
92- Write-Host "$("##vso[task.setvariable variable=MY_NUGET_VERSION]")$MyNuGetVersion"
93- condition : succeeded()
94- displayName : Get NuGet build number
95-
96- - task : UseRubyVersion@0
97- inputs :
98- versionSpec : ' >= 2.4'
99- addToPath : true
100- condition : and( succeeded(), not( startsWith(variables['Build.SourceBranch'], 'refs/pull') ) )
101- displayName : Setup Ruby
102-
103- # generate change log
104- - powershell : |
105- gem install github_changelog_generator --quiet --no-ri --no-rdoc
106- # need to call it passing both cache options with full path otherwise it won't work
107- github_changelog_generator --token $(GitHubToken) --cache-log $env:AGENT_TEMPDIRECTORY\github-changelog-logger.log --cache-file $env:AGENT_TEMPDIRECTORY\github-changelog-http-cache
108- 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') ) )
109- displayName : Generate change log
110-
111- # generate change log including future version
112- - powershell : |
113- gem install github_changelog_generator --quiet --no-ri --no-rdoc
114- # need to call it passing both cache options with full path otherwise it won't work
115- 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
116- 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') ) ) )
117- displayName : Generate change log
118-
119- # copy change log to artifacts directory
120- - task : CopyFiles@2
121- inputs :
122- SourceFolder : ' $(System.DefaultWorkingDirectory)'
123- Contents : ' CHANGELOG.md'
124- TargetFolder : ' $(Build.ArtifactStagingDirectory)'
125- condition : and( succeeded(), not( startsWith(variables['Build.SourceBranch'], 'refs/pull') ), not( startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ) )
126- displayName : Copy Changelog
127-
128- # push new changelog to GitHub repo
129- - script : |
130- git add CHANGELOG.md
131- git commit -m "Update CHANGELOG for v$(NBGV_Version)" -m"***NO_CI***"
132- git push origin "HEAD:$(Build.SourceBranchName)" --porcelain
133- workingDirectory : $(System.DefaultWorkingDirectory)
134- condition : and( succeeded(), not( startsWith(variables['Build.SourceBranch'], 'refs/pull') ), not( startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ) )
135- displayName : Push changelog to GitHub
136-
137- # update could build number (only possible if this is not a PR from a fork)
138- - task : PowerShell@2
139- inputs :
140- targetType : ' inline'
141- script : Write-Host "$("##vso[build.updatebuildnumber]")$env:NBGV_NuGetPackageVersion"
142- condition : and( succeeded(), ne(variables['system.pullrequest.isfork'], true) )
143- displayName : Update cloud build number
144-
145- - task : NuGetCommand@2
146- inputs :
147- command : ' custom'
148- arguments : ' pack source\$(nugetPackageName).nuspec -Version $(MY_NUGET_VERSION) -Symbols'
149- condition : succeeded()
150- displayName : Pack NuGet with class library
151-
152- # - task: NuGetCommand@2
153- # inputs:
154- # command: 'custom'
155- # arguments: 'pack source\$(nugetPackageName).DELIVERABLES.nuspec -Version $(MY_NUGET_VERSION) -Symbols'
156- # displayName: Pack NuGet with build deliverables class library
157-
158- - task : CopyFiles@1
159- inputs :
160- sourceFolder : $(Build.SourcesDirectory)
161- Contents : |
162- **\$(nugetPackageName)*.nupkg
163- TargetFolder : ' $(Build.ArtifactStagingDirectory)'
164- flattenFolders : true
165- condition : succeeded()
166- displayName : Collecting deployable artifacts
167-
168- # publish artifacts (only possible if this is not a PR originated on a fork)
169- - task : PublishBuildArtifacts@1
170- inputs :
171- PathtoPublish : ' $(Build.ArtifactStagingDirectory)'
172- ArtifactName : deployables
173- ArtifactType : Container
174- condition : and( succeeded(), ne(variables['system.pullrequest.isfork'], true) )
175- displayName : Publish deployables artifacts
176-
177- # push NuGet packages to MyGet feed (always happens except on PR builds)
178- - task : NuGetCommand@2
179- inputs :
180- command : push
181- nuGetFeedType : external
182- packagesToPush : ' $(Build.ArtifactStagingDirectory)/*.nupkg'
183- publishFeedCredentials : ' MyGet'
184- condition : succeeded()
185- displayName : Push NuGet packages to MyGet
186-
187- # # push NuGet class lib package to NuGet (happens on tag builds for any branch)
188- # - task: NuGetCommand@2
189- # inputs:
190- # command: push
191- # nuGetFeedType: external
192- # packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'
193- # publishFeedCredentials: 'NuGet'
194- # condition: and( succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v') )
195- # displayName: Push NuGet packages to NuGet
196-
197- # create or update GitHub release
198- - task : GitHubReleasePublish@1
199- inputs :
200- githubEndpoint : ' nfbot'
201- githubOwner : ' nanoframework'
202- githubRepositoryName : $(repoName)
203- githubTag : v$(MY_NUGET_VERSION)
204- githubReleaseTitle : ' $(nugetPackageName) Library v$(MY_NUGET_VERSION)'
205- githubReleaseNotes : ' Check the [changelog]($(Build.Repository.Uri)/blob/$(Build.SourceBranchName)/CHANGELOG.md).<br><h4>Install from nanoFramework MyGet development feed</h4>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).'
206- githubTargetCommitsh : $(Build.SourceVersion)
207- githubReleaseDraft : true
208- githubReleasePrerelease : true
209- githubReuseDraftOnly : true
210- githubReuseRelease : true
211- githubEditRelease : true
212- githubReleaseAsset : ' $(Build.ArtifactStagingDirectory)/$(nugetPackageName).$(MY_NUGET_VERSION).nupkg'
213- condition : and( succeeded(), not( startsWith(variables['Build.SourceBranch'], 'refs/pull') ) )
214- displayName : Create/Update GitHub release
215-
216- # create or update GitHub release ON tags from release or master branches
217- - task : GitHubReleasePublish@1
218- inputs :
219- githubEndpoint : ' nfbot'
220- githubOwner : ' nanoframework'
221- githubRepositoryName : $(repoName)
222- githubTag : v$(MY_NUGET_VERSION)
223- githubReleaseTitle : ' $(nugetPackageName) Library v$(MY_NUGET_VERSION)'
224- githubReleaseNotes : ' Check the [changelog]($(Build.Repository.Uri)/blob/$(Build.SourceBranchName)/CHANGELOG.md).<br><h4>Install from NuGet</h4>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).'
225- githubTargetCommitsh : $(Build.SourceVersion)
226- githubReleaseDraft : true
227- githubReleasePrerelease : false
228- githubReuseDraftOnly : true
229- githubReuseRelease : true
230- githubEditRelease : true
231- githubReleaseAsset : ' $(Build.ArtifactStagingDirectory)/$(nugetPackageName).$(MY_NUGET_VERSION).nupkg'
232- condition : and( succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), or( eq(variables['Build.SourceBranchName'], 'master'), contains(variables['Build.SourceBranchName'], 'release') ) )
233- displayName : Create/Update GitHub release
234-
235- # update assembly declaration in nf-interpreter
236- - task : UpdateNativeAssemblyDeclaration@1
237- inputs :
238- sourceFileName : ' nf_networking_sntp.cpp'
239- classLibName : $(nugetPackageName)
240- gitHubToken : $(GitHubToken)
241- nuGetVersion : $(MY_NUGET_VERSION)
242- assemblyVersion : $(NBGV_Version)
243- condition : and( succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v') )
244- displayName : Update assembly declaration in nf-interpreter
46+ # step from template @ nf-tools repo
47+ # all build, update and publish steps
48+ - template : azure-pipelines-templates/class-lib-build.yml@templates
24549
24650# step from template @ nf-tools repo
51+ # report error
24752- template : azure-pipelines-templates/discord-webhook-task.yml@templates
24853 parameters :
24954 status : ' failure'
0 commit comments