Update azure-pipelines.yml for Azure Pipelines
This commit is contained in:
+129
-78
@@ -11,100 +11,151 @@ variables:
|
|||||||
- name: build.version.minor
|
- name: build.version.minor
|
||||||
value: 0
|
value: 0
|
||||||
- name: build.version.revision
|
- name: build.version.revision
|
||||||
value: 0
|
value: $[counter(format('{0}.{1}', variables['build.version.major'], variables['build.version.minor'], 0)]
|
||||||
- name: build.version.beta
|
|
||||||
value: $[counter(format('{0}.{1}.{2}', variables['build.version.major'], variables['build.version.minor'], variables['build.version.revision']), 0)]
|
|
||||||
- name: build.version.suffix
|
|
||||||
value: -beta1.$(build.version.beta)
|
|
||||||
- name: build.version
|
- name: build.version
|
||||||
value: $(build.version.major).$(build.version.minor).$(build.version.revision)$(build.version.suffix)
|
value: $(build.version.major).$(build.version.minor).$(build.version.revision)
|
||||||
- name: build.date
|
- name: build.date
|
||||||
value: $[format('{0:yyyy}-{0:MM}-{0:dd}T{0:HH}:{0:mm}:{0:ss}', pipeline.startTime)]
|
value: $[format('{0:yyyy}-{0:MM}-{0:dd}T{0:HH}:{0:mm}:{0:ss}', pipeline.startTime)]
|
||||||
- group: Azure KeyVault Code Signing
|
- group: Azure KeyVault Code Signing
|
||||||
|
|
||||||
name: $(build.version.major).$(build.version.minor).$(build.version.revision)$(build.version.suffix)
|
name: $(build.version.major).$(build.version.minor).$(build.version.revision)
|
||||||
|
trigger: none
|
||||||
|
|
||||||
steps:
|
stages:
|
||||||
- task: NuGetToolInstaller@1
|
- stage: build
|
||||||
|
displayName: Build credential provider
|
||||||
|
dependsOn: []
|
||||||
|
jobs:
|
||||||
|
- job: "buildjob"
|
||||||
|
steps:
|
||||||
|
- task: DotNetCoreCLI@2
|
||||||
|
displayName: dotnet build
|
||||||
|
inputs:
|
||||||
|
command: build
|
||||||
|
publishWebProjects: false
|
||||||
|
arguments: '-c $(buildConfiguration) -p:Version=$(build.version) -p:PackageOutputPath=$(Build.ArtifactStagingDirectory)'
|
||||||
|
projects: 'src/Lithnet.CredentialProvider/Lithnet.CredentialProvider.csproj'
|
||||||
|
zipAfterPublish: false
|
||||||
|
|
||||||
- task: DotNetCoreCLI@2
|
- task: DotNetCoreCLI@2
|
||||||
displayName: dotnet build
|
inputs:
|
||||||
inputs:
|
command: 'custom'
|
||||||
command: build
|
custom: 'tool'
|
||||||
publishWebProjects: false
|
arguments: 'update --global NuGetKeyVaultSignTool'
|
||||||
arguments: '-c $(buildConfiguration) -p:Version=$(build.version) -p:PackageOutputPath=$(Build.ArtifactStagingDirectory)'
|
displayName: Install NugetKeyVaultSignTool
|
||||||
projects: 'src/Lithnet.CredentialProvider/Lithnet.CredentialProvider.csproj'
|
|
||||||
zipAfterPublish: false
|
|
||||||
|
|
||||||
- task: DotNetCoreCLI@2
|
- task: DotNetCoreCLI@2
|
||||||
inputs:
|
inputs:
|
||||||
command: 'custom'
|
command: 'custom'
|
||||||
custom: 'tool'
|
custom: 'tool'
|
||||||
arguments: 'update --global NuGetKeyVaultSignTool'
|
arguments: 'update --global azuresigntool'
|
||||||
displayName: Install NugetKeyVaultSignTool
|
displayName: Install AzureSignTool
|
||||||
|
|
||||||
- task: DotNetCoreCLI@2
|
- task: PowerShell@2
|
||||||
inputs:
|
displayName: 'Sign files with AzureSignTool'
|
||||||
command: 'custom'
|
inputs:
|
||||||
custom: 'tool'
|
targetType: 'inline'
|
||||||
arguments: 'update --global azuresigntool'
|
script: |
|
||||||
displayName: Install AzureSignTool
|
$files = @()
|
||||||
|
$files += (Get-ChildItem -Recurse -Path "$(Build.SourcesDirectory)\Lithnet*.dll").FullName
|
||||||
|
|
||||||
- task: PowerShell@2
|
write-host "Signing $($files.Length) files:"
|
||||||
displayName: 'Sign files with AzureSignTool'
|
write-output $files
|
||||||
inputs:
|
|
||||||
targetType: 'inline'
|
|
||||||
script: |
|
|
||||||
$files = @()
|
|
||||||
$files += (Get-ChildItem -Recurse -Path "$(Build.SourcesDirectory)\Lithnet*.dll").FullName
|
|
||||||
|
|
||||||
write-host "Signing $($files.Length) files:"
|
$cmdargs = @(
|
||||||
write-output $files
|
"sign",
|
||||||
|
"-d", "Lithnet Windows Credential Provider",
|
||||||
|
"-kvu", "$(akv.url)",
|
||||||
|
"-kvi", "$(akv.applicationID)",
|
||||||
|
"-kvs", "$(akv.secret)",
|
||||||
|
"-kvt", "$(akv.tenantId)",
|
||||||
|
"-kvc", "$(akv.certificateName)",
|
||||||
|
"-tr", "http://timestamp.digicert.com",
|
||||||
|
"-td", "sha256"
|
||||||
|
)
|
||||||
|
|
||||||
$cmdargs = @(
|
$cmdargs += $files
|
||||||
"sign",
|
|
||||||
"-d", "Lithnet Windows Credential Provider",
|
|
||||||
"-kvu", "$(akv.url)",
|
|
||||||
"-kvi", "$(akv.applicationID)",
|
|
||||||
"-kvs", "$(akv.secret)",
|
|
||||||
"-kvt", "$(akv.tenantId)",
|
|
||||||
"-kvc", "$(akv.certificateName)",
|
|
||||||
"-tr", "http://timestamp.digicert.com",
|
|
||||||
"-td", "sha256"
|
|
||||||
)
|
|
||||||
|
|
||||||
$cmdargs += $files
|
& AzureSignTool $cmdargs
|
||||||
|
failOnStderr: true
|
||||||
|
showWarnings: true
|
||||||
|
|
||||||
& AzureSignTool $cmdargs
|
- task: PowerShell@2
|
||||||
|
displayName: 'Sign Nuget package'
|
||||||
|
inputs:
|
||||||
|
targetType: 'inline'
|
||||||
|
script: |
|
||||||
|
$cmdargs = @(
|
||||||
|
"sign", "$(Build.ArtifactStagingDirectory)\Lithnet.CredentialProvider.$(build.version).nupkg"
|
||||||
|
"-fd", "sha256",
|
||||||
|
"-kvu", "$(akv.url)",
|
||||||
|
"-kvi", "$(akv.applicationID)",
|
||||||
|
"-kvs", "$(akv.secret)",
|
||||||
|
"-kvt", "$(akv.tenantId)",
|
||||||
|
"-kvc", "$(akv.certificateName)",
|
||||||
|
"-tr", "http://timestamp.digicert.com",
|
||||||
|
"-td", "sha256"
|
||||||
|
)
|
||||||
|
|
||||||
failOnStderr: true
|
& NuGetKeyVaultSignTool $cmdargs
|
||||||
showWarnings: true
|
failOnStderr: true
|
||||||
|
showWarnings: true
|
||||||
|
|
||||||
- task: PowerShell@2
|
- task: PowerShell@2
|
||||||
displayName: 'Sign Nuget package'
|
displayName: 'Sign Nuget symbols package'
|
||||||
inputs:
|
inputs:
|
||||||
targetType: 'inline'
|
targetType: 'inline'
|
||||||
script: |
|
script: |
|
||||||
$cmdargs = @(
|
$cmdargs = @(
|
||||||
"sign", "$(Build.ArtifactStagingDirectory)\Lithnet.CredentialProvider.$(build.version).nupkg"
|
"sign", "$(Build.ArtifactStagingDirectory)\Lithnet.CredentialProvider.$(build.version).snupkg"
|
||||||
"-fd", "sha256",
|
"-fd", "sha256",
|
||||||
"-kvu", "$(akv.url)",
|
"-kvu", "$(akv.url)",
|
||||||
"-kvi", "$(akv.applicationID)",
|
"-kvi", "$(akv.applicationID)",
|
||||||
"-kvs", "$(akv.secret)",
|
"-kvs", "$(akv.secret)",
|
||||||
"-kvt", "$(akv.tenantId)",
|
"-kvt", "$(akv.tenantId)",
|
||||||
"-kvc", "$(akv.certificateName)",
|
"-kvc", "$(akv.certificateName)",
|
||||||
"-tr", "http://timestamp.digicert.com",
|
"-tr", "http://timestamp.digicert.com",
|
||||||
"-td", "sha256"
|
"-td", "sha256"
|
||||||
)
|
)
|
||||||
|
|
||||||
& NuGetKeyVaultSignTool $cmdargs
|
& NuGetKeyVaultSignTool $cmdargs
|
||||||
|
failOnStderr: true
|
||||||
|
showWarnings: true
|
||||||
|
|
||||||
failOnStderr: true
|
- task: DotNetCoreCLI@2
|
||||||
showWarnings: true
|
displayName: Publish package to internal feed
|
||||||
|
inputs:
|
||||||
|
command: 'push'
|
||||||
|
packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'
|
||||||
|
nuGetFeedType: 'internal'
|
||||||
|
publishVstsFeed: '91a552bc-359d-4f28-bdbd-f36f71cfdf81'
|
||||||
|
|
||||||
- task: NuGetCommand@2
|
- task: DotNetCoreCLI@2
|
||||||
displayName: 'NuGet push'
|
displayName: Publish symbols to internal feed
|
||||||
inputs:
|
inputs:
|
||||||
command: push
|
command: 'push'
|
||||||
nuGetFeedType: external
|
packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'
|
||||||
publishFeedCredentials: 'WindowsCredentialProviderNuget'
|
nuGetFeedType: 'internal'
|
||||||
|
publishVstsFeed: '91a552bc-359d-4f28-bdbd-f36f71cfdf81'
|
||||||
|
|
||||||
|
- stage: publish
|
||||||
|
displayName: Publish packages to production feed
|
||||||
|
dependsOn: "build"
|
||||||
|
jobs:
|
||||||
|
- deployment: 'PublishPackages'
|
||||||
|
environment: 'Production'
|
||||||
|
displayName: Publish packages to public nuget feed
|
||||||
|
pool:
|
||||||
|
vmImage: windows-2022
|
||||||
|
strategy:
|
||||||
|
runOnce:
|
||||||
|
deploy:
|
||||||
|
steps:
|
||||||
|
- checkout: self
|
||||||
|
|
||||||
|
- task: NuGetCommand@2
|
||||||
|
displayName: 'Publish nuget package to public feed'
|
||||||
|
inputs:
|
||||||
|
command: push
|
||||||
|
nuGetFeedType: external
|
||||||
|
publishFeedCredentials: 'WindowsCredentialProviderNuget'
|
||||||
Reference in New Issue
Block a user