Skip to content

Commit fec0c84

Browse files
committed
Work CI-CD
- Update yaml. - Fix Nuget and github release tasks.
1 parent fb957fd commit fec0c84

File tree

1 file changed

+67
-47
lines changed

1 file changed

+67
-47
lines changed

azure-pipelines.yml

Lines changed: 67 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
trigger:
22
branches:
3-
include: [master, develop, "release-*" ]
3+
include: [main, develop, "release-*" ]
44
paths:
5-
exclude: ["*.md", .gitignore]
5+
exclude: [README.md, LICENSE.md, CHANGELOG.md, version.json, "*.md", .gitignore]
66
tags:
77
include: ["v*"]
88

@@ -17,7 +17,7 @@ resources:
1717
endpoint: nanoframework
1818

1919
pool:
20-
vmImage: 'VS2017-Win2016'
20+
vmImage: 'windows-2019'
2121

2222
variables:
2323
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
@@ -52,6 +52,9 @@ steps:
5252

5353
# need to push remaining packages to NuGet individually because the template above can only push one package (happens on tag builds for any branch)
5454
- task: NuGetCommand@2
55+
condition: and( succeeded(), ne( variables['StartReleaseCandidate'], true ) )
56+
continueOnError: true
57+
displayName: Push "Serial" variant NuGet package to Azure Artifacts
5558
inputs:
5659
command: push
5760
nuGetFeedType: external
@@ -61,11 +64,11 @@ steps:
6164
$(Build.ArtifactStagingDirectory)/nanoFramework.Logging.Serial.$(MY_NUGET_VERSION).snupkg
6265
publishFeedCredentials: 'AzureArtifacts-$(System.TeamProject)'
6366
includeSymbols: true
64-
condition: and( succeeded(), ne( variables['StartReleaseCandidate'], true ) )
65-
continueOnError: true
66-
displayName: Push "Serial" variant NuGet package to Azure Artifacts
6767

6868
- task: NuGetCommand@2
69+
condition: and( succeeded(), ne( variables['StartReleaseCandidate'], true ) )
70+
continueOnError: true
71+
displayName: Push "Stream" variant NuGet package to Azure Artifacts
6972
inputs:
7073
command: push
7174
nuGetFeedType: external
@@ -75,11 +78,25 @@ steps:
7578
$(Build.ArtifactStagingDirectory)/nanoFramework.Logging.Stream.$(MY_NUGET_VERSION).snupkg
7679
publishFeedCredentials: 'AzureArtifacts-$(System.TeamProject)'
7780
includeSymbols: true
78-
condition: and( succeeded(), ne( variables['StartReleaseCandidate'], true ) )
81+
82+
- task: NuGetCommand@2
83+
condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), ne( variables['StartReleaseCandidate'], true ) )
7984
continueOnError: true
80-
displayName: Push "Stream" variant NuGet package to Azure Artifacts
85+
displayName: Push base NuGet package to Azure Artifacts
86+
inputs:
87+
command: push
88+
nuGetFeedType: external
89+
allowPackageConflicts: true
90+
packagesToPush:
91+
$(Build.ArtifactStagingDirectory)/nanoFramework.Logging.$(MY_NUGET_VERSION).nupkg
92+
$(Build.ArtifactStagingDirectory)/nanoFramework.Logging.$(MY_NUGET_VERSION).snupkg
93+
publishFeedCredentials: 'AzureArtifacts-$(System.TeamProject)'
94+
includeSymbols: true
8195

8296
- task: NuGetCommand@2
97+
condition: and( succeeded(), ne( variables['StartReleaseCandidate'], true ) )
98+
continueOnError: true
99+
displayName: Push "Serial" variant NuGet package to Azure Artifacts
83100
inputs:
84101
command: push
85102
nuGetFeedType: external
@@ -89,11 +106,11 @@ steps:
89106
$(Build.ArtifactStagingDirectory)/nanoFramework.Logging.Serial.$(MY_NUGET_VERSION).snupkg
90107
publishFeedCredentials: 'NuGet-$(System.TeamProject)'
91108
includeSymbols: true
92-
condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), ne( variables['StartReleaseCandidate'], true ) )
93-
continueOnError: true
94-
displayName: Push "Serial" variant NuGet package to NuGet
95109

96110
- task: NuGetCommand@2
111+
condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), ne( variables['StartReleaseCandidate'], true ) )
112+
continueOnError: true
113+
displayName: Push "Stream" variant NuGet package to NuGet
97114
inputs:
98115
command: push
99116
nuGetFeedType: external
@@ -103,49 +120,52 @@ steps:
103120
$(Build.ArtifactStagingDirectory)/nanoFramework.Logging.Stream.$(MY_NUGET_VERSION).snupkg
104121
publishFeedCredentials: 'NuGet-$(System.TeamProject)'
105122
includeSymbols: true
123+
124+
- task: NuGetCommand@2
106125
condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), ne( variables['StartReleaseCandidate'], true ) )
107126
continueOnError: true
108-
displayName: Push "Stream" variant NuGet package to NuGet
127+
displayName: Push base NuGet package to NuGet
128+
inputs:
129+
command: push
130+
nuGetFeedType: external
131+
allowPackageConflicts: true
132+
packagesToPush:
133+
$(Build.ArtifactStagingDirectory)/nanoFramework.Logging.$(MY_NUGET_VERSION).nupkg
134+
$(Build.ArtifactStagingDirectory)/nanoFramework.Logging.$(MY_NUGET_VERSION).snupkg
135+
publishFeedCredentials: 'NuGet-$(System.TeamProject)'
136+
includeSymbols: true
109137

110138
# create or update GitHub release
111-
- task: GitHubReleasePublish@1
139+
- task: GithubRelease@1
140+
condition: and( succeeded(), eq(variables['System.PullRequest.PullRequestId'], ''), not( startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ), ne( variables['StartReleaseCandidate'], true ) )
141+
displayName: Create/Update GitHub PREVIEW release
112142
inputs:
113-
githubEndpoint: 'nanoframework'
114-
githubOwner: 'nanoframework'
115-
githubRepositoryName: $(repoName)
116-
githubTag: v$(MY_NUGET_VERSION)
117-
githubReleaseTitle: '$(nugetPackageName) Library v$(MY_NUGET_VERSION)'
118-
githubReleaseNotes: 'Check the [changelog]($(Build.Repository.Uri)/blob/$(Build.SourceBranchName)/CHANGELOG.md).<br><br><h4>Install from NuGet</h4><br>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).<br>:package: [.NET (Serial API only)](https://www.nuget.org/packages/nanoFramework.Logging.Serial/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION)<br>:package: [.NET (server API only)](https://www.nuget.org/packages/nanoFramework.Logging.Server/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION)'
119-
githubTargetCommitsh: $(Build.SourceVersion)
120-
githubReleaseDraft: false
121-
githubReleasePrerelease: true
122-
githubReuseDraftOnly: false
123-
githubReuseRelease: true
124-
githubEditRelease: true
125-
githubDeleteEmptyTag: true
126-
githubReleaseAsset: '$(Build.ArtifactStagingDirectory)/*.nupkg'
127-
condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), not( startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ), ne( variables['StartReleaseCandidate'], true ) )
128-
displayName: Create/Update GitHub PREVIEW release
129-
130-
# create or update GitHub release ON tags from release or master branches
131-
- task: GitHubReleasePublish@1
132-
inputs:
133-
githubEndpoint: 'nanoframework'
134-
githubOwner: 'nanoframework'
135-
githubRepositoryName: $(repoName)
136-
githubTag: v$(MY_NUGET_VERSION)
137-
githubReleaseTitle: '$(nugetPackageName) Library v$(MY_NUGET_VERSION)'
138-
githubReleaseNotes: 'Check the [changelog]($(Build.Repository.Uri)/blob/$(Build.SourceBranchName)/CHANGELOG.md).<br><br><h4>Install from NuGet</h4><br>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).<br>:package: [.NET (Stream API only)](https://www.nuget.org/packages/nanoFramework.Logging.Stream/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION)<br>:package: [.NET (server API only)](https://www.nuget.org/packages/nanoFramework.Logging.Server/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION)'
139-
githubTargetCommitsh: $(Build.SourceVersion)
140-
githubReleaseDraft: false
141-
githubReleasePrerelease: false
142-
githubReuseDraftOnly: false
143-
githubReuseRelease: true
144-
githubEditRelease: true
145-
githubDeleteEmptyTag: true
146-
githubReleaseAsset: '$(Build.ArtifactStagingDirectory)/*.nupkg'
143+
gitHubConnection: 'github.com_nano-$(System.TeamProject)'
144+
tagSource: userSpecifiedTag
145+
tag: v$(MY_NUGET_VERSION)
146+
title: '$(nugetPackageName) Library v$(MY_NUGET_VERSION)'
147+
releaseNotesSource: inline
148+
releaseNotesInline: 'Check the [changelog]($(Build.Repository.Uri)/blob/$(Build.SourceBranchName)/CHANGELOG.md).<br><br><h4>Install from NuGet</h4><br>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).<br>:package: [.NET (Serial API only)](https://www.nuget.org/packages/nanoFramework.Logging.Serial/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION)<br>:package: [.NET (Serial API only)](https://www.nuget.org/packages/nanoFramework.Logging.Serial/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION)'
149+
assets: '$(Build.ArtifactStagingDirectory)/$(nugetPackageName).$(MY_NUGET_VERSION).nupkg'
150+
assetUploadMode: replace
151+
isPreRelease: true
152+
addChangeLog: false
153+
154+
# create or update GitHub release ON tags from release or main branches
155+
- task: GithubRelease@1
147156
condition: and( succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), not(contains(variables['Build.SourceBranch'], 'preview') ), ne( variables['StartReleaseCandidate'], true ) )
148157
displayName: Create/Update GitHub stable release
158+
inputs:
159+
gitHubConnection: 'github.com_nano-$(System.TeamProject)'
160+
tagSource: userSpecifiedTag
161+
tag: v$(MY_NUGET_VERSION)
162+
title: '$(nugetPackageName) Library v$(MY_NUGET_VERSION)'
163+
releaseNotesSource: inline
164+
releaseNotesInline: 'Check the [changelog]($(Build.Repository.Uri)/blob/$(Build.SourceBranchName)/CHANGELOG.md).<br><br><h4>Install from NuGet</h4><br>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).<br>:package: [.NET (Stream API only)](https://www.nuget.org/packages/nanoFramework.Logging.Stream/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION)<br>:package: [.NET (Serial API only)](https://www.nuget.org/packages/nanoFramework.Logging.Serial/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION)'
165+
assets: '$(Build.ArtifactStagingDirectory)/$(nugetPackageName).$(MY_NUGET_VERSION).nupkg'
166+
assetUploadMode: replace
167+
isPreRelease: false
168+
addChangeLog: false
149169

150170
# step from template @ nf-tools repo
151171
# report error

0 commit comments

Comments
 (0)