44 - master
55 - develop
66 - release/*
7+ - refs/tags/*
78 paths :
89 exclude :
910 - /*.md
@@ -38,6 +39,7 @@ variables:
3839 buildPlatform : ' Any CPU'
3940 buildConfiguration : ' Release'
4041 nugetPackageName : ' nanoFramework.Networking.Sntp'
42+ repoName : ' lib-nanoFramework.Networking.Sntp'
4143
4244steps :
4345
@@ -48,10 +50,6 @@ steps:
4850- script : |
4951 git config --global user.email "nfbot@users.noreply.github.com"
5052 git config --global user.name "nfbot"
51-
52- echo "SourceBranchName $(Build.SourceBranchName)"
53- echo "SourceBranch $(Build.SourceBranch)"
54- echo "Reason $(Build.Reason)
5553 displayName : Setup git identity
5654
5755- task : NuGetToolInstaller@0
8179 inputs :
8280 targetType : ' inline'
8381 script : |
84- $MyNuGetVersion = $env:NBGV_NuGetPackageVersion -replace "\-g$env:NBGV_GitCommitIdShort", " "
82+ $MyNuGetVersion = $env:NBGV_NuGetPackageVersion -replace "\-g$env:NBGV_GitCommitIdShort", ""
8583
8684 # replace preview with alpha if this is a PR build
8785 if($env:Build_Reason -eq 'PullRequest')
@@ -99,23 +97,23 @@ steps:
9997 inputs :
10098 versionSpec : ' >= 2.4'
10199 addToPath : true
102- condition : and( succeeded(), not( contains (variables['Build.SourceBranch'], 'pull') ) )
100+ condition : and( succeeded(), not( startsWith (variables['Build.SourceBranch'], 'refs/ pull') ) )
103101 displayName : Setup Ruby
104102
105- # generate change log including future version
103+ # generate change log
106104- powershell : |
107105 gem install github_changelog_generator --quiet --no-ri --no-rdoc
108106 # need to call it passing both cache options with full path otherwise it won't work
109107 github_changelog_generator --token $(GitHubToken) --cache-log $env:AGENT_TEMPDIRECTORY\github-changelog-logger.log --cache-file $env:AGENT_TEMPDIRECTORY\github-changelog-http-cache
110- condition : and( succeeded(), not( contains (variables['Build.SourceBranch'], 'pull') ), not( contains (variables['Build.SourceBranch'], 'tags') ), or( eq(variables['Build.SourceBranchName'], 'master'), contains(variables['Build.SourceBranchName'], 'release') ) )
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') ) )
111109 displayName : Generate change log
112110
113111# generate change log including future version
114112- powershell : |
115113 gem install github_changelog_generator --quiet --no-ri --no-rdoc
116114 # need to call it passing both cache options with full path otherwise it won't work
117115 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
118- condition : and( succeeded(), not( contains (variables['Build.SourceBranch'], 'pull') ), not( contains (variables['Build.SourceBranch'], 'tags') ), not( or( eq(variables['Build.SourceBranchName'], 'master'), contains(variables['Build.SourceBranchName'], 'release') ) ) )
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') ) ) )
119117 displayName : Generate change log
120118
121119# copy change log to artifacts directory
@@ -124,17 +122,17 @@ steps:
124122 SourceFolder : ' $(System.DefaultWorkingDirectory)'
125123 Contents : ' CHANGELOG.md'
126124 TargetFolder : ' $(Build.ArtifactStagingDirectory)'
127- condition : and( succeeded(), not( contains (variables['Build.SourceBranch'], 'pull') ) )
125+ condition : and( succeeded(), not( startsWith (variables['Build.SourceBranch'], 'refs/ pull') ) )
128126 displayName : Copy Changelog
129127
130128# push new changelog to GitHub repo
131129- script : |
132130 git add CHANGELOG.md
133- git commit -m "Update CHANGELOG for v$(NBGV_Version)"
131+ git commit -m "Update CHANGELOG for v$(NBGV_Version)" -m"***NO_CI***"
134132 # need to wrap the git command bellow so it doesn't throw an error because of redirecting the output to stderr
135133 git push origin "HEAD:$(Build.SourceBranchName)" --porcelain
136134 workingDirectory : $(System.DefaultWorkingDirectory)
137- condition : and( succeeded(), not( contains (variables['Build.SourceBranch'], 'pull') ), not( contains (variables['Build.SourceBranch'], 'tags') ) )
135+ condition : and( succeeded(), not( startsWith (variables['Build.SourceBranch'], 'refs/ pull') ), not( startsWith (variables['Build.SourceBranch'], 'refs/ tags/v ') ) )
138136 displayName : Push changelog to GitHub
139137
140138# update could build number (only possible if this is not a PR from a fork)
@@ -182,7 +180,7 @@ steps:
182180 inputs :
183181 command : push
184182 nuGetFeedType : external
185- packagesToPush : ' $(Build.ArtifactStagingDirectory)/*.nupkg;!$(Build.ArtifactStagingDirectory)/*.symbols.nupkg '
183+ packagesToPush : ' $(Build.ArtifactStagingDirectory)/*.nupkg'
186184 publishFeedCredentials : ' MyGet'
187185 condition : succeeded()
188186 displayName : Push NuGet packages to MyGet
@@ -192,11 +190,47 @@ steps:
192190 inputs :
193191 command : push
194192 nuGetFeedType : external
195- packagesToPush : ' $(Build.ArtifactStagingDirectory)/$(nugetPackageName).nupkg;!$(Build.ArtifactStagingDirectory)/$(nugetPackageName).symbols .nupkg'
193+ packagesToPush : ' $(Build.ArtifactStagingDirectory)/* .nupkg'
196194 publishFeedCredentials : ' NuGet'
197- condition : and( succeeded(), not( contains (variables['Build.SourceBranch'], 'pull') ), contains (variables['Build.SourceBranch'], 'tags') )
195+ condition : and( succeeded(), not( startsWith (variables['Build.SourceBranch'], 'refs/ pull') ), startsWith (variables['Build.SourceBranch'], 'refs/ tags/v ') )
198196 displayName : Push NuGet packages to NuGet
199197
198+ # create or update GitHub release
199+ - task : GitHubReleasePublish@1
200+ inputs :
201+ githubEndpoint : ' nfbot'
202+ githubOwner : ' nanoframework'
203+ githubRepositoryName : $(repoName)
204+ githubTag : v$(MY_NUGET_VERSION)
205+ githubReleaseTitle : ' $(nugetPackageName) Library v$(MY_NUGET_VERSION)'
206+ 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).'
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
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+ githubReleaseDraft : true
226+ githubReleasePrerelease : true
227+ githubReuseDraftOnly : true
228+ githubReuseRelease : true
229+ githubEditRelease : true
230+ githubReleaseAsset : ' $(Build.ArtifactStagingDirectory)/$(nugetPackageName).$(MY_NUGET_VERSION).nupkg'
231+ condition : and( succeeded(), not( startsWith(variables['Build.SourceBranch'], 'refs/pull') ), startsWith(variables['Build.SourceBranch'], 'refs/tags/v') )
232+ displayName : Create/Update GitHub release
233+
200234# step from template @ nf-tools repo
201235# update assembly declaration in nf-interpreter
202236- template : azure-pipelines-templates/update-assembly-declarations.yml@templates
0 commit comments