|
| 1 | +trigger: |
| 2 | + branches: |
| 3 | + include: [main, develop, "release-*" ] |
| 4 | + paths: |
| 5 | + exclude: [README.md, LICENSE.md, CHANGELOG.md, version.json, "*.md", .gitignore] |
| 6 | + tags: |
| 7 | + include: ["v*"] |
| 8 | + |
| 9 | +# PR always trigger build |
| 10 | + |
| 11 | +# add nf-tools repo to resources (for Azure Pipelines templates) |
| 12 | +resources: |
| 13 | + repositories: |
| 14 | + - repository: templates |
| 15 | + type: github |
| 16 | + name: nanoframework/nf-tools |
| 17 | + endpoint: nanoframework |
| 18 | + |
| 19 | +pool: |
| 20 | + vmImage: 'windows-2019' |
| 21 | + |
| 22 | +variables: |
| 23 | + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true |
| 24 | + solution: '**/*.sln' |
| 25 | + buildPlatform: 'Any CPU' |
| 26 | + buildConfiguration: 'Release' |
| 27 | + nugetPackageName: 'nanoFramework.System.Net.WebSockets' |
| 28 | + repoName: 'nanoFramework.System.Net.WebSockets' |
| 29 | + |
| 30 | +steps: |
| 31 | + |
| 32 | +# step from template @ nf-tools repo |
| 33 | +# build steps only |
| 34 | +- template: azure-pipelines-templates/class-lib-build-only.yml@templates |
| 35 | + parameters: |
| 36 | + sonarCloudProject: 'nanoframework_lib-nanoFramework.System.Net.WebSockets' |
| 37 | + |
| 38 | +# package steps |
| 39 | +- template: azure-pipelines-templates/class-lib-package.yml@templates |
| 40 | + parameters: |
| 41 | + nugetPackageName: 'nanoFramework.System.Net.WebSockets' |
| 42 | + |
| 43 | +- template: azure-pipelines-templates/class-lib-package.yml@templates |
| 44 | + parameters: |
| 45 | + nugetPackageName: 'nanoFramework.System.Net.WebSockets.Client' |
| 46 | + |
| 47 | +- template: azure-pipelines-templates/class-lib-package.yml@templates |
| 48 | + parameters: |
| 49 | + nugetPackageName: 'nanoFramework.System.Net.WebSockets.Server' |
| 50 | + |
| 51 | +- template: azure-pipelines-templates/class-lib-publish.yml@templates |
| 52 | + |
| 53 | +# need to push remaining packages to NuGet individually because the template above can only push one package (happens on tag builds for any branch) |
| 54 | +- task: NuGetCommand@2 |
| 55 | + condition: and( succeeded(), ne( variables['StartReleaseCandidate'], true ) ) |
| 56 | + continueOnError: true |
| 57 | + displayName: Push "Client" variant NuGet package to Azure Artifacts |
| 58 | + inputs: |
| 59 | + command: push |
| 60 | + nuGetFeedType: external |
| 61 | + allowPackageConflicts: true |
| 62 | + packagesToPush: |
| 63 | + $(Build.ArtifactStagingDirectory)/nanoFramework.System.Net.WebSockets.Client.$(MY_NUGET_VERSION).nupkg |
| 64 | + $(Build.ArtifactStagingDirectory)/nanoFramework.System.Net.WebSockets.Client.$(MY_NUGET_VERSION).snupkg |
| 65 | + publishFeedCredentials: 'AzureArtifacts-$(System.TeamProject)' |
| 66 | + includeSymbols: true |
| 67 | + |
| 68 | +- task: NuGetCommand@2 |
| 69 | + condition: and( succeeded(), ne( variables['StartReleaseCandidate'], true ) ) |
| 70 | + continueOnError: true |
| 71 | + displayName: Push "Server" variant NuGet package to Azure Artifacts |
| 72 | + inputs: |
| 73 | + command: push |
| 74 | + nuGetFeedType: external |
| 75 | + allowPackageConflicts: true |
| 76 | + packagesToPush: |
| 77 | + $(Build.ArtifactStagingDirectory)/nanoFramework.System.Net.WebSockets.Server.$(MY_NUGET_VERSION).nupkg |
| 78 | + $(Build.ArtifactStagingDirectory)/nanoFramework.System.Net.WebSockets.Server.$(MY_NUGET_VERSION).snupkg |
| 79 | + publishFeedCredentials: 'AzureArtifacts-$(System.TeamProject)' |
| 80 | + includeSymbols: true |
| 81 | + |
| 82 | +- task: NuGetCommand@2 |
| 83 | + condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), ne( variables['StartReleaseCandidate'], true ) ) |
| 84 | + continueOnError: true |
| 85 | + displayName: Push "Client" variant NuGet package to NuGet |
| 86 | + inputs: |
| 87 | + command: push |
| 88 | + nuGetFeedType: external |
| 89 | + allowPackageConflicts: true |
| 90 | + packagesToPush: |
| 91 | + $(Build.ArtifactStagingDirectory)/nanoFramework.System.Net.WebSockets.Client.$(MY_NUGET_VERSION).nupkg |
| 92 | + $(Build.ArtifactStagingDirectory)/nanoFramework.System.Net.WebSockets.Client.$(MY_NUGET_VERSION).snupkg |
| 93 | + publishFeedCredentials: 'NuGet-$(System.TeamProject)' |
| 94 | + includeSymbols: true |
| 95 | + |
| 96 | +- task: NuGetCommand@2 |
| 97 | + condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), ne( variables['StartReleaseCandidate'], true ) ) |
| 98 | + continueOnError: true |
| 99 | + displayName: Push "Server" variant NuGet package to NuGet |
| 100 | + inputs: |
| 101 | + command: push |
| 102 | + nuGetFeedType: external |
| 103 | + allowPackageConflicts: true |
| 104 | + packagesToPush: |
| 105 | + $(Build.ArtifactStagingDirectory)/nanoFramework.System.Net.WebSockets.Server.$(MY_NUGET_VERSION).nupkg |
| 106 | + $(Build.ArtifactStagingDirectory)/nanoFramework.System.Net.WebSockets.Server.$(MY_NUGET_VERSION).snupkg |
| 107 | + publishFeedCredentials: 'NuGet-$(System.TeamProject)' |
| 108 | + includeSymbols: true |
| 109 | + |
| 110 | +# create or update GitHub release |
| 111 | +- task: GithubRelease@1 |
| 112 | + condition: and( succeeded(), eq(variables['System.PullRequest.PullRequestId'], ''), not( startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ), ne( variables['StartReleaseCandidate'], true ) ) |
| 113 | + displayName: Create/Update GitHub PREVIEW release |
| 114 | + inputs: |
| 115 | + gitHubConnection: 'github.com_nano-$(System.TeamProject)' |
| 116 | + tagSource: userSpecifiedTag |
| 117 | + tag: v$(MY_NUGET_VERSION) |
| 118 | + title: '$(nugetPackageName) Library v$(MY_NUGET_VERSION)' |
| 119 | + releaseNotesSource: inline |
| 120 | + 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 (client API only)](https://www.nuget.org/packages/nanoFramework.System.Net.WebSockets.Client/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION)<br>:package: [.NET (server API only)](https://www.nuget.org/packages/nanoFramework.System.Net.WebSockets.Server/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION)' |
| 121 | + assets: '$(Build.ArtifactStagingDirectory)/$(nugetPackageName).$(MY_NUGET_VERSION).nupkg' |
| 122 | + assetUploadMode: replace |
| 123 | + isPreRelease: true |
| 124 | + addChangeLog: false |
| 125 | + |
| 126 | +# create or update GitHub release ON tags from release or main branches |
| 127 | +- task: GithubRelease@1 |
| 128 | + condition: and( succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), not(contains(variables['Build.SourceBranch'], 'preview') ), ne( variables['StartReleaseCandidate'], true ) ) |
| 129 | + displayName: Create/Update GitHub stable release |
| 130 | + inputs: |
| 131 | + gitHubConnection: 'github.com_nano-$(System.TeamProject)' |
| 132 | + tagSource: userSpecifiedTag |
| 133 | + tag: v$(MY_NUGET_VERSION) |
| 134 | + title: '$(nugetPackageName) Library v$(MY_NUGET_VERSION)' |
| 135 | + releaseNotesSource: inline |
| 136 | + 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 (client API only)](https://www.nuget.org/packages/nanoFramework.System.Net.WebSockets.Client/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION)<br>:package: [.NET (server API only)](https://www.nuget.org/packages/nanoFramework.System.Net.WebSockets.Server/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION)' |
| 137 | + assets: '$(Build.ArtifactStagingDirectory)/$(nugetPackageName).$(MY_NUGET_VERSION).nupkg' |
| 138 | + assetUploadMode: replace |
| 139 | + isPreRelease: false |
| 140 | + addChangeLog: false |
| 141 | + |
| 142 | +# step from template @ nf-tools repo |
| 143 | +# report error |
| 144 | +- template: azure-pipelines-templates/discord-webhook-task.yml@templates |
| 145 | + parameters: |
| 146 | + status: 'failure' |
| 147 | + webhookUrl: '$(DiscordWebhook)' |
| 148 | + message: '' |
0 commit comments