Tooling/azure-pipelines.yml

132 строки
3.8 KiB
YAML

trigger:
- main
- refs/tags/*
- dev
variables:
- name: Solution
value: 'Tooling'
- name: ProductVersion
value: '0.7.1'
- name: PackageVersion
value: $[format('0.7.1-{0}', variables['Build.BuildId'])]
- name: DotNet2Version
value: 2.1.x
- name: DotNet3Version
value: 3.1.x
- name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE
value: true
- name: DOTNET_CLI_TELEMETRY_OPTOUT
value: 1
- group: 'PackageSigningSecrets'
jobs:
- job: 'Linux'
pool:
vmImage: 'Ubuntu-16.04'
steps:
- task: UseDotNet@2
displayName: 'Setup DotNet2 $(DotNet2Version)'
inputs:
packageType: sdk
version: $(DotNet2Version)
- task: UseDotNet@2
displayName: 'Setup DotNet3 $(DotNet3Version)'
inputs:
packageType: sdk
version: $(DotNet3Version)
- task: 'DotNetCoreCLI@2'
displayName: 'Build'
inputs:
command: 'build'
projects: '$(Solution).sln'
arguments: '--configuration Release /p:TreatWarningsAsErrors=True'
- task: 'DotNetCoreCLI@2'
displayName: 'Test'
inputs:
command: 'test'
projects: '$(Solution).sln'
- job: 'OSX'
pool:
vmImage: 'macOS-10.14'
steps:
- task: UseDotNet@2
displayName: 'Setup DotNet2 $(DotNet2Version)'
inputs:
packageType: sdk
version: $(DotNet2Version)
- task: UseDotNet@2
displayName: 'Setup DotNet3 $(DotNet3Version)'
inputs:
packageType: sdk
version: $(DotNet3Version)
- task: 'DotNetCoreCLI@2'
displayName: 'Build'
inputs:
command: 'build'
projects: '$(Solution).sln'
arguments: '--configuration Release /p:TreatWarningsAsErrors=True'
- task: 'DotNetCoreCLI@2'
displayName: 'Test'
inputs:
command: 'test'
projects: '$(Solution).sln'
- job: 'Windows'
pool:
vmImage: 'Windows-2019'
steps:
- pwsh: |
if ($env:BUILD_SOURCEBRANCH -match "^refs\/tags\/(.+)")
{
$env:PackageVersion = $Matches.1
}
Write-Host "build version set to $env:PackageVersion"
$prefix = $env:PackageVersion.Split('-')[0]
$suffix = $env:PackageVersion.Split('-')[1]
Write-Host "##vso[build.updatebuildnumber]$env:PackageVersion"
Write-Host "##vso[task.setvariable variable=PackageVersion;]$env:PackageVersion"
Write-Host "##vso[task.setvariable variable=VersionPrefix;]$prefix"
Write-Host "##vso[task.setvariable variable=VersionSuffix;]$suffix"
env:
PackageVersion: $(PackageVersion)
displayName: 'Version'
- task: UseDotNet@2
displayName: 'Setup DotNet2 $(DotNet2Version)'
inputs:
packageType: sdk
version: $(DotNet2Version)
- task: UseDotNet@2
displayName: 'Setup DotNet3 $(DotNet3Version)'
inputs:
packageType: sdk
version: $(DotNet3Version)
- task: 'DotNetCoreCLI@2'
displayName: 'Build'
inputs:
command: 'pack'
packagesToPack: '$(Solution).sln'
arguments: '--configuration $(buildConfiguration) /p:TreatWarningsAsErrors=True /p:VersionPrefix=$(VersionPrefix) /p:VersionSuffix=$(VersionSuffix)'
versioningScheme: 'byEnvVar'
versionEnvVar: 'PackageVersion'
- task: 'DotNetCoreCLI@2'
displayName: 'Test'
inputs:
command: 'test'
projects: '$(Solution).sln'
- task: PowerShell@2
displayName: 'Sign'
inputs:
filePath: build/sign-packages.ps1
env:
SignClientUser: $(SignClientUser)
SignClientSecret: $(SignClientSecret)
ArtifactDirectory: $(Build.ArtifactStagingDirectory)
condition: and(succeeded(), not(eq(variables['build.reason'], 'PullRequest')), not(eq(variables['SignClientSecret'], '')), not(eq(variables['SignClientUser'], '')))
- task: 'PublishBuildArtifacts@1'
displayName: 'Publish'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'Packages'
publishLocation: 'Container'
condition: 'always()'