Last active
November 11, 2020 15:50
-
-
Save jguadagno/b99bec48d4ecde8b4cec72b119fbdcfa to your computer and use it in GitHub Desktop.
The Azure Pipeline Yaml for the blog post.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generic script to build, test, sign, and deploy NuGet packages | |
# Check out the post: https://www.josephguadagno.com/posts/2020-04-12-build-sign-and-deploy-nuget-packages-with-azure-pipelines for more details. | |
parameters: | |
- name: buildConfig | |
displayName: Build Configuration to Use | |
default: Debug | |
values: | |
- Debug | |
- Release | |
trigger: | |
- master | |
pool: | |
vmImage: 'windows-latest' | |
variables: | |
- name: buildConfiguration | |
value: ${{ parameters.buildConfig }} | |
- group: CodeSigning | |
steps: | |
- task: UseDotNet@2 | |
displayName: Setup .NET SDK Version 3.x | |
inputs: | |
packageType: sdk | |
version: 3.x | |
includePreviewVersions: true | |
- task: DotNetCoreCLI@2 | |
displayName: 'Build the Assembly' | |
inputs: | |
command: build | |
versioningScheme: byBuildNumber | |
arguments: '--configuration $(BuildConfiguration)' | |
- task: DotNetCoreCLI@2 | |
displayName: 'Run the Unit Tests' | |
inputs: | |
command: 'test' | |
- task: DotNetCoreCLI@2 | |
displayName: Package up the Assembly | |
inputs: | |
command: 'pack' | |
packagesToPack: './src/*.csproj' | |
nobuild: true | |
verbosityPack: 'Normal' | |
- task: DotNetCoreCLI@2 | |
displayName: Install NuGetKeyVaultSignTool | |
inputs: | |
command: 'custom' | |
custom: 'tool' | |
arguments: 'install --tool-path . NuGetKeyVaultSignTool' | |
- task: PowerShell@2 | |
displayName: Running NuGetKeyVaultSign | |
inputs: | |
targetType: 'inline' | |
script: | | |
.\NuGetKeyVaultSignTool sign ./src/**/*.nupkg ` | |
--file-digest "sha256" ` | |
--timestamp-rfc3161 "http://timestamp.digicert.com" ` | |
--timestamp-digest "sha256" ` | |
--azure-key-vault-url "$(azure-key-vault-url)" ` | |
--azure-key-vault-tenant-id "$(azure-key-vault-tenant-id)" ` | |
--azure-key-vault-client-id "$(azure-key-vault-client-id)" ` | |
--azure-key-vault-client-secret "$(azure-key-vault-client-secret)" ` | |
--azure-key-vault-certificate "JosephGuadagno-2021" | |
- task: DotNetCoreCLI@2 | |
displayName: 'Publish the NuGet Package' | |
inputs: | |
command: 'push' | |
packagesToPush: './src/**/*.nupkg' | |
nuGetFeedType: 'internal' | |
publishVstsFeed: 'bdc1f818-5671-40af-9cef-f81e5856505f' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment