|
1 | | -# DotNetCore Restore/Build/Test/Pack/Publish |
| 1 | +# Azure Pipelines Template for NuGet Packages |
| 2 | +# Copyright © Solid Token (https://www.solidtoken.nl) |
2 | 3 |
|
3 | 4 | variables: |
4 | | - BuildConfiguration: Release |
5 | | - |
| 5 | +- name: ProjectName |
| 6 | + value: 'SpecFlow.DependencyInjection' |
| 7 | +- name: TestProjectName |
| 8 | + value: 'SpecFlow.DependencyInjection.Tests' |
| 9 | +- name: NuGetPackageName |
| 10 | + value: 'SolidToken.SpecFlow.DependencyInjection' |
| 11 | +- name: NuGetDescription |
| 12 | + value: 'SpecFlow plugin that enables to use Microsoft.Extensions.DependencyInjection for resolving test dependencies.' |
| 13 | +- name: BuildConfiguration |
| 14 | + value: 'Release' |
| 15 | +- name: GitHubConnection |
| 16 | + value: 'Solid Token GitHub' |
| 17 | +- name: NuGetConnection |
| 18 | + value: 'Solid Token NuGet' |
| 19 | +- group: CodeSigning |
| 20 | + |
6 | 21 | trigger: |
7 | 22 | - main |
8 | 23 |
|
9 | | -pool: |
10 | | - vmImage: 'windows-latest' |
| 24 | +stages: |
| 25 | +- stage: CI |
| 26 | + jobs: |
| 27 | + - job: Build |
| 28 | + steps: |
| 29 | + - task: gitversion/setup@0 |
| 30 | + displayName: 'Prepare' |
| 31 | + inputs: |
| 32 | + versionSpec: '5.x' |
| 33 | + - task: gitversion/execute@0 |
| 34 | + name: 'Version' |
| 35 | + - task: DotNetCoreCLI@2 |
| 36 | + displayName: 'Build' |
| 37 | + inputs: |
| 38 | + command: 'build' |
| 39 | + projects: '$(ProjectName)' |
| 40 | + arguments: '--configuration $(BuildConfiguration)' |
| 41 | + - task: DotNetCoreCLI@2 |
| 42 | + displayName: 'Test' |
| 43 | + inputs: |
| 44 | + command: 'test' |
| 45 | + projects: '$(TestProjectName)' |
| 46 | + arguments: '--configuration $(BuildConfiguration) --collect "XPlat Code Coverage"' |
| 47 | + - task: DotNetCoreCLI@2 |
| 48 | + displayName: 'Pack' |
| 49 | + inputs: |
| 50 | + command: 'pack' |
| 51 | + packagesToPack: '$(ProjectName)' |
| 52 | + configuration: '$(BuildConfiguration)' |
| 53 | + nobuild: true |
| 54 | + includesymbols: true |
| 55 | + - task: PublishPipelineArtifact@1 |
| 56 | + displayName: 'Publish' |
| 57 | + inputs: |
| 58 | + targetPath: '$(Build.ArtifactStagingDirectory)' |
| 59 | + artifactName: '$(ProjectName)' |
| 60 | + - task: PublishCodeCoverageResults@1 |
| 61 | + displayName: 'Report' |
| 62 | + inputs: |
| 63 | + codeCoverageTool: 'Cobertura' |
| 64 | + summaryFileLocation: '$(Agent.TempDirectory)/*/coverage.cobertura.xml' |
| 65 | + |
| 66 | +- stage: CD |
| 67 | + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main')) |
| 68 | + jobs: |
| 69 | + - job: Release |
| 70 | + variables: |
| 71 | + SemVer: $[stageDependencies.CI.Build.outputs['Version.GitVersion.SemVer']] |
| 72 | + FullSemVer: $[stageDependencies.CI.Build.outputs['Version.GitVersion.FullSemVer']] |
| 73 | + NuGetVersion: $[stageDependencies.CI.Build.outputs['Version.GitVersion.NuGetVersion']] |
| 74 | + InformationalVersion: $[stageDependencies.CI.Build.outputs['Version.GitVersion.InformationalVersion']] |
| 75 | + steps: |
| 76 | + - task: DotNetCoreCLI@2 |
| 77 | + displayName: 'Prepare' |
| 78 | + inputs: |
| 79 | + command: 'custom' |
| 80 | + custom: 'tool' |
| 81 | + arguments: 'install --tool-path . NuGetKeyVaultSignTool' |
| 82 | + - task: DownloadPipelineArtifact@2 |
| 83 | + displayName: 'Download' |
| 84 | + inputs: |
| 85 | + artifactName: '$(ProjectName)' |
| 86 | + - task: PowerShell@2 |
| 87 | + displayName: 'Sign' |
| 88 | + inputs: |
| 89 | + targetType: 'inline' |
| 90 | + script: | |
| 91 | + .\NuGetKeyVaultSignTool sign $(Pipeline.Workspace)/*.nupkg ` |
| 92 | + --file-digest "sha256" ` |
| 93 | + --timestamp-rfc3161 "http://timestamp.sectigo.com" ` |
| 94 | + --timestamp-digest "sha256" ` |
| 95 | + --azure-key-vault-url "$(azure-key-vault-url)" ` |
| 96 | + --azure-key-vault-tenant-id "$(azure-key-vault-tenant-id)" ` |
| 97 | + --azure-key-vault-client-id "$(azure-key-vault-client-id)" ` |
| 98 | + --azure-key-vault-client-secret "$(azure-key-vault-client-secret)" ` |
| 99 | + --azure-key-vault-certificate "$(azure-key-vault-certificate)" |
| 100 | + - task: NuGetCommand@2 |
| 101 | + displayName: 'Push' |
| 102 | + inputs: |
| 103 | + command: 'push' |
| 104 | + packagesToPush: '$(Pipeline.Workspace)/*.nupkg' |
| 105 | + nuGetFeedType: 'external' |
| 106 | + publishFeedCredentials: '$(NuGetConnection)' |
| 107 | + includeSymbols: true |
| 108 | + - task: GitHubRelease@1 |
| 109 | + displayName: 'Release' |
| 110 | + inputs: |
| 111 | + gitHubConnection: '$(GitHubConnection)' |
| 112 | + repositoryName: '$(Build.Repository.Name)' |
| 113 | + action: 'edit' |
| 114 | + target: '$(Build.SourceVersion)' |
| 115 | + tagSource: 'userSpecifiedTag' |
| 116 | + tag: 'v$(SemVer)' |
| 117 | + title: 'v$(FullSemVer)' |
| 118 | + assets: '$(Pipeline.Workspace)/*' |
| 119 | + releaseNotesSource: 'inline' |
| 120 | + releaseNotesInline: | |
| 121 | + $(NuGetDescription) |
| 122 | + https://www.nuget.org/packages/$(NuGetPackageName)/$(NuGetVersion) |
11 | 123 |
|
12 | | -steps: |
13 | | -- task: DotNetCoreCLI@2 |
14 | | - displayName: Restore |
15 | | - inputs: |
16 | | - command: restore |
17 | | -- task: DotNetCoreCLI@2 |
18 | | - displayName: Build |
19 | | - inputs: |
20 | | - command: build |
21 | | - projects: 'SpecFlow.DependencyInjection' |
22 | | - arguments: '--configuration $(BuildConfiguration)' |
23 | | -- task: DotNetCoreCLI@2 |
24 | | - displayName: Test .NET Framework 4.6.1 |
25 | | - inputs: |
26 | | - command: test |
27 | | - projects: 'SpecFlow.DependencyInjection.Tests' |
28 | | - arguments: '--configuration $(BuildConfiguration) --framework net461' |
29 | | -- task: DotNetCoreCLI@2 |
30 | | - displayName: Test .NET Core 2.1 |
31 | | - inputs: |
32 | | - command: test |
33 | | - projects: 'SpecFlow.DependencyInjection.Tests' |
34 | | - arguments: '--configuration $(BuildConfiguration) --framework netcoreapp2.1' |
35 | | -- task: DotNetCoreCLI@2 |
36 | | - displayName: Test .NET Core 3.1 |
37 | | - inputs: |
38 | | - command: test |
39 | | - projects: 'SpecFlow.DependencyInjection.Tests' |
40 | | - arguments: '--configuration $(BuildConfiguration) --framework netcoreapp3.1' |
41 | | -- task: DotNetCoreCLI@2 |
42 | | - displayName: Pack |
43 | | - inputs: |
44 | | - command: pack |
45 | | - packagesToPack: 'SpecFlow.DependencyInjection' |
46 | | - nobuild: true |
47 | | -- task: PublishBuildArtifacts@1 |
48 | | - displayName: Publish |
49 | | - inputs: |
50 | | - PathtoPublish: '$(Build.ArtifactStagingDirectory)' |
51 | | - ArtifactName: 'NuGet' |
52 | | - publishLocation: 'Container' |
| 124 | + `$(informationalVersion)` |
| 125 | + changeLogCompareToRelease: 'lastFullRelease' |
| 126 | + changeLogType: 'commitBased' |
| 127 | + isDraft: false |
0 commit comments