From c7d161519138fcfa3298a0d795e0d302f82ef14c Mon Sep 17 00:00:00 2001 From: James Newton-King Date: Sun, 16 Sep 2018 13:52:07 -0700 Subject: [PATCH] Only strong name in master builds (#1830) --- azure-pipelines.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 38ce19ed..1b4dda69 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -2,24 +2,27 @@ pool: vmImage: 'VS2017-Win2016' steps: +- powershell: | + $basePath = resolve-path . + $keyPath = "$basePath\key.snk" + $keyData = [System.Convert]::FromBase64String($Env:KEY_DATA) + [System.IO.File]::WriteAllBytes($keyPath, $keyData) + env: + KEY_DATA: $(newtonsoft.keyData) + displayName: 'Prepare signing key' + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) + - powershell: | $buildNumber = [int]$Env:BUILD_ID write-host "Build number $buildNumber" -fore white $basePath = resolve-path . $keyPath = "$basePath\key.snk" - $sign = $false - if ($Env:KEY_DATA) - { - $keyData = [System.Convert]::FromBase64String($Env:KEY_DATA) - [System.IO.File]::WriteAllBytes($keyPath, $keyData) - $sign = $true - } + $sign = test-path $keyPath write-host "Sign assemblies $sign" -fore white $formattedBuildNumber = $buildNumber.ToString("D6") $nugetPrerelease = "build$formattedBuildNumber" .\Build\runbuild.ps1 -properties @{"signAssemblies"=$sign; "signKeyPath"=$keyPath; "treatWarningsAsErrors"=$true; "nugetPrerelease"=$nugetPrerelease;} env: - KEY_DATA: $(newtonsoft.keyData) BUILD_ID: $(Build.BuildId) displayName: 'Run build' @@ -40,4 +43,5 @@ steps: pathtoPublish: .\Working artifactName: artifacts parallel: true - parallelCount: 8 \ No newline at end of file + parallelCount: 8 + displayName: 'Publish artifacts' \ No newline at end of file