110 lines
3.1 KiB
YAML
110 lines
3.1 KiB
YAML
pool:
|
|
vmImage: 'windows-latest'
|
|
|
|
variables:
|
|
buildPlatform: 'Any CPU'
|
|
buildConfiguration: 'Release'
|
|
build.version.major: 1
|
|
build.version.minor: 0
|
|
build.version.revision: 0
|
|
build.version.beta: $[counter(format('{0}.{1}.{2}', variables['build.version.major'], variables['build.version.minor'], variables['build.version.revision']), 0)]
|
|
build.version.suffix: -beta1.$(build.version.beta)
|
|
build.version: $(build.version.major).$(build.version.minor).$(build.version.revision)$(build.version.suffix)
|
|
build.date: $[format('{0:yyyy}-{0:MM}-{0:dd}T{0:HH}:{0:mm}:{0:ss}', pipeline.startTime)]
|
|
|
|
name: $(version)
|
|
|
|
steps:
|
|
- task: NuGetToolInstaller@1
|
|
|
|
- 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
|
|
inputs:
|
|
command: 'custom'
|
|
custom: 'tool'
|
|
arguments: 'update --global NuGetKeyVaultSignTool'
|
|
displayName: Install NugetKeyVaultSignTool
|
|
|
|
- task: DotNetCoreCLI@2
|
|
inputs:
|
|
command: 'custom'
|
|
custom: 'tool'
|
|
arguments: 'update --global azuresigntool'
|
|
displayName: Install AzureSignTool
|
|
|
|
- task: PowerShell@2
|
|
displayName: 'Sign files with AzureSignTool'
|
|
inputs:
|
|
targetType: 'inline'
|
|
script: |
|
|
$files = @()
|
|
$files += (Get-ChildItem -Path "$(Build.ArtifactStagingDirectory)\Lithnet*.dll").FullName
|
|
|
|
write-host "Signing $($files.Length) files:"
|
|
write-output $files
|
|
|
|
$cmdargs = @(
|
|
"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
|
|
|
|
- task: PowerShell@2
|
|
displayName: 'Sign Nuget package'
|
|
inputs:
|
|
targetType: 'inline'
|
|
script: |
|
|
$files = @()
|
|
$files += (Get-ChildItem -Path "$(Build.ArtifactStagingDirectory)\Lithnet*.dll").FullName
|
|
|
|
write-host "Signing $($files.Length) files:"
|
|
write-output $files
|
|
|
|
$cmdargs = @(
|
|
"sign", "$(Build.ArtifactStagingDirectory)\*.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"
|
|
)
|
|
|
|
$cmdargs += $files
|
|
|
|
& NuGetKeyVaultSignTool $cmdargs
|
|
|
|
failOnStderr: true
|
|
showWarnings: true
|
|
|
|
- task: DotNetCoreCLI@2
|
|
displayName: dotnet push
|
|
inputs:
|
|
command: 'push'
|
|
packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'
|
|
nuGetFeedType: 'external'
|
|
publishFeedCredentials: 'WindowsCredentialProviderNuget'
|