-
Notifications
You must be signed in to change notification settings - Fork 108
/
azure-pipelines.yml
74 lines (64 loc) · 2.44 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
trigger:
- master
- release/*
pool:
vmImage: 'windows-2022'
variables:
- group: Newtonsoft
steps:
- task: UseDotNet@2
inputs:
version: '8.0.x'
- task: UseDotNet@2
inputs:
version: '6.0.x'
packageType: runtime
- powershell: |
dotnet --info
displayName: 'Dotnet installs'
- powershell: |
$basePath = resolve-path .
$keyPath = "$basePath\key.snk"
$keyData = [System.Convert]::FromBase64String($Env:KeyData)
[System.IO.File]::WriteAllBytes($keyPath, $keyData)
env:
KeyData: $(newtonsoft.keyData)
displayName: 'Prepare signing key'
condition: and(succeeded(), not(eq(variables['build.reason'], 'PullRequest')))
- powershell: |
$basePath = resolve-path .
$keyPath = "$basePath\key.snk"
$sign = test-path $keyPath
write-host "Sign assemblies $sign" -fore white
$version = Get-Content .\Build\version.json | Out-String | ConvertFrom-Json
$buildNumber = [int]$Env:BuildId
write-host "Build number $buildNumber" -fore white
$nugetPrerelease = if ($Env:SourceBranch.StartsWith("refs/heads/release/")) { $version.Prerelease } else { "build$($buildNumber.ToString("D6"))" }
write-host "Prerelease $nugetPrerelease" -fore white
$assemblyVersion = if ($version.Assembly) { $version.Assembly } else { "$($version.Major).0.0.0" }
write-host "Assembly $assemblyVersion" -fore white
.\Build\runbuild.ps1 -properties @{"majorVersion"="$($version.Major).0"; "majorWithReleaseVersion"="$($version.Major).0.$($version.Release)"; "nugetPrerelease"=$nugetPrerelease; "assemblyVersion"=$assemblyVersion; "zipFileName"="JsonSchema$($version.Major)0r$($version.Release).zip"; "signAssemblies"=$sign; "signKeyPath"=$keyPath; "treatWarningsAsErrors"=$true; "buildNuGet"=$true; "ensureNetCliSdk"=$false}
env:
BuildId: $(Build.BuildId)
SourceBranch: $(Build.SourceBranch)
displayName: 'Run build'
- task: PublishTestResults@2
inputs:
testRunner: 'NUnit'
testResultsFiles: '**/Working/*.xml'
displayName: 'Publish NUnit results'
condition: succeededOrFailed()
- task: PublishTestResults@2
inputs:
testRunner: 'VSTest'
testResultsFiles: '**/Working/*.trx'
displayName: 'Publish dotnet test results'
condition: succeededOrFailed()
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: .\Working
artifactName: artifacts
parallel: true
parallelCount: 8
displayName: 'Publish artifacts'
condition: and(succeeded(), not(eq(variables['build.reason'], 'PullRequest')))