win32metadata/azure-pipelines-apidocs.yml

136 строки
4.2 KiB
YAML

trigger:
branches:
include:
- main
paths:
include:
- apidocs
batch: true
pr:
branches:
include:
- main
paths:
include:
- apidocs
variables:
BuildConfiguration: Release
jobs:
- job: build_docs
displayName: Build API docs
pool:
vmImage: ubuntu-20.04
steps:
- checkout: self
clean: true
submodules: recursive
- task: UseDotNet@2
displayName: ⚙ Install .NET SDK
inputs:
packageType: sdk
useGlobalJson: true
# ESRP Authenticode sign package DLLs
- task: UseDotNet@2
displayName: ⚙ Install .NET Core 2.1.x
inputs:
packageType: runtime
version: 2.1.x
- powershell: dotnet tool update --global nbgv
displayName: ⚙ Install nbgv
- script: dotnet build -c $(BuildConfiguration)
displayName: 🏭 dotnet build
workingDirectory: apidocs
- task: EsrpCodeSigning@1
displayName: ✒ Assembly sign
inputs:
ConnectedServiceName: Xlang Code Signing
FolderPath: $(System.DefaultWorkingDirectory)/bin/$(BuildConfiguration)/netstandard2.0
Pattern: '*.dll'
signConfigType: inlineSignParams
inlineOperation: |
[
{
"keyCode": "CP-230012",
"operationSetCode": "SigntoolSign",
"parameters": [
{
"parameterName": "OpusName",
"parameterValue": "Microsoft"
},
{
"parameterName": "OpusInfo",
"parameterValue": "http://www.microsoft.com"
},
{
"parameterName": "PageHash",
"parameterValue": "/NPH"
},
{
"parameterName": "FileDigest",
"parameterValue": "/fd sha256"
},
{
"parameterName": "TimeStamp",
"parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
}
],
"toolName": "signtool.exe",
"toolVersion": "6.2.9304.0"
}
]
SessionTimeout: 60
MaxConcurrency: 50
MaxRetryAttempts: 5
condition: and(succeeded(), eq(variables['SignFiles'], 'true'), ne(variables['Build.Reason'], 'PullRequest'))
- script: dotnet pack Microsoft.Windows.SDK.Win32Docs --no-build -c $(BuildConfiguration) -p:BuildProjectReferences=false
displayName: 📦 dotnet pack
workingDirectory: apidocs
- task: EsrpCodeSigning@1
displayName: ✒ NuGet sign
inputs:
ConnectedServiceName: Xlang Code Signing
FolderPath: $(System.DefaultWorkingDirectory)/bin/Packages/$(BuildConfiguration)/NuGet
Pattern: '*.nupkg'
signConfigType: inlineSignParams
inlineOperation: |
[
{
"KeyCode" : "CP-401405",
"OperationCode" : "NuGetSign",
"Parameters" : {},
"ToolName" : "sign",
"ToolVersion" : "1.0"
},
{
"KeyCode" : "CP-401405",
"OperationCode" : "NuGetVerify",
"Parameters" : {},
"ToolName" : "sign",
"ToolVersion" : "1.0"
}
]
SessionTimeout: 60
MaxConcurrency: 50
MaxRetryAttempts: 5
condition: and(succeeded(), eq(variables['SignFiles'], 'true'), ne(variables['Build.Reason'], 'PullRequest'))
- publish: bin/Packages/$(BuildConfiguration)/NuGet
artifact: ApiDocsNuGetPackages
displayName: 📢 Publish package
- publish: bin/$(BuildConfiguration)/netstandard2.0/documentationMappings.rsp
artifact: ApiDocsMetadata
displayName: 📢 Publish metadata
# # There's a problem on microsoft.visualstudio.com that requires the guid instead of NuGetCommand@2
# # Don't publish if we're using pre-generated source
# - task: 333b11bd-d341-40d9-afcf-b32d5ce6f23b@2
# displayName: 📤 NuGet push
# inputs:
# command: push
# packagesToPush: $(System.DefaultWorkingDirectory)/bin/Packages/$(BuildConfiguration)/NuGet/*.nupkg
# publishVstsFeed: c1408dcb-1833-4ae4-9af5-1a891a12cc3c
# allowPackageConflicts: true
# condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))