Browse Source

Add code signing scripts

Oren Novotny 9 years ago
parent
commit
2b4bf46aa5
6 changed files with 73 additions and 2 deletions
  1. 27 1
      Ix.NET/Source/build-new.ps1
  2. 27 1
      Rx.NET/Source/build-new.ps1
  3. 2 0
      appveyor.ix.yml
  4. 2 0
      appveyor.rx.yml
  5. 2 0
      appveyor.yml
  6. 13 0
      scripts/SignClientSettings.json

+ 27 - 1
Ix.NET/Source/build-new.ps1

@@ -6,10 +6,14 @@ $nuspecDir = Join-Path $scriptPath "NuSpecs"
 $isAppVeyor = Test-Path -Path env:\APPVEYOR
 $isAppVeyor = Test-Path -Path env:\APPVEYOR
 $outputLocation = Join-Path $scriptPath "testResults"
 $outputLocation = Join-Path $scriptPath "testResults"
 
 
+$signClientSettings = Join-Path (Join-Path (Get-Item $scriptPath).Parent.Parent.FullName "scripts") "SignClientSettings.json"
+$hasSignClientSecret = !([string]::IsNullOrEmpty($env:SignClientSecret))
+$signClientAppPath = Join-Path (Join-Path (Join-Path .\Packages "SignClient") "Tools") "SignClient.dll"
+
 #remove any old coverage file
 #remove any old coverage file
 md -Force $outputLocation | Out-Null
 md -Force $outputLocation | Out-Null
 $outputPath = (Resolve-Path $outputLocation).Path
 $outputPath = (Resolve-Path $outputLocation).Path
-$outputFile = Join-Path $outputPath -childpath 'coverage.xml'
+$outputFile = Join-Path $outputPath -childpath 'coverage-ix.xml'
 Remove-Item $outputPath -Force -Recurse
 Remove-Item $outputPath -Force -Recurse
 md -Force $outputLocation | Out-Null
 md -Force $outputLocation | Out-Null
 
 
@@ -24,6 +28,7 @@ $msbuildExe = Join-Path $msbuild.MSBuildToolsPath "msbuild.exe"
 
 
 # get tools
 # get tools
 .\nuget.exe install -excludeversion gitversion.commandline -outputdirectory packages
 .\nuget.exe install -excludeversion gitversion.commandline -outputdirectory packages
+.\nuget.exe install -excludeversion SignClient -Version 0.5.0-beta3 -pre -outputdirectory packages
 .\nuget.exe install -excludeversion OpenCover -outputdirectory packages
 .\nuget.exe install -excludeversion OpenCover -outputdirectory packages
 .\nuget.exe install -excludeversion ReportGenerator -outputdirectory packages
 .\nuget.exe install -excludeversion ReportGenerator -outputdirectory packages
 .\nuget.exe install -excludeversion coveralls.io -outputdirectory packages
 .\nuget.exe install -excludeversion coveralls.io -outputdirectory packages
@@ -74,7 +79,28 @@ foreach ($nuspec in $nuspecs) {
       $host.SetShouldExit($LastExitCode)
       $host.SetShouldExit($LastExitCode)
     }  
     }  
   }
   }
+}
+
+if($hasSignClientSecret) {
+  Write-Host "Signing Packages" -Foreground Green
+  $nupgks = ls .\artifacts\*.nupkg | Select -ExpandProperty FullName
+
+  foreach ($nupkg in $nupgks) {
+    Write-Host "Submitting $nupkg for signing"
+
+    dotnet $signClientAppPath 'zip' -c $signClientSettings -i $nupkg -s $env:SignClientSecret -n 'Ix.NET' -d 'Interactive Extensions for .NET' -u 'http://reactivex.io/' 
+
+    if ($LastExitCode -ne 0) { 
+        Write-Host "Error signing $nupkg" -Foreground Red
+        if($isAppVeyor) {
+          $host.SetShouldExit($LastExitCode)
+        }  
+    }
+    Write-Host "Finished signing $nupkg"
+  }
 
 
+} else {
+  Write-Host "Client Secret not found, not signing packages"
 }
 }
 
 
 Write-Host "Running tests" -Foreground Green
 Write-Host "Running tests" -Foreground Green

+ 27 - 1
Rx.NET/Source/build-new.ps1

@@ -7,10 +7,14 @@ $isAppVeyor = Test-Path -Path env:\APPVEYOR
 $outputLocation = Join-Path $scriptPath "testResults"
 $outputLocation = Join-Path $scriptPath "testResults"
 $openCoverPath = ".\packages\OpenCover\tools\OpenCover.Console.exe"
 $openCoverPath = ".\packages\OpenCover\tools\OpenCover.Console.exe"
 
 
+$signClientSettings = Join-Path (Join-Path (Get-Item $scriptPath).Parent.Parent.FullName "scripts") "SignClientSettings.json"
+$hasSignClientSecret = !([string]::IsNullOrEmpty($env:SignClientSecret))
+$signClientAppPath = Join-Path (Join-Path (Join-Path .\Packages "SignClient") "Tools") "SignClient.dll"
+
 #remove any old coverage file
 #remove any old coverage file
 md -Force $outputLocation | Out-Null
 md -Force $outputLocation | Out-Null
 $outputPath = (Resolve-Path $outputLocation).Path
 $outputPath = (Resolve-Path $outputLocation).Path
-$outputFile = Join-Path $outputPath -childpath 'coverage.xml'
+$outputFile = Join-Path $outputPath -childpath 'coverage-rx.xml'
 Remove-Item $outputPath -Force -Recurse
 Remove-Item $outputPath -Force -Recurse
 md -Force $outputLocation | Out-Null
 md -Force $outputLocation | Out-Null
 
 
@@ -24,6 +28,7 @@ $msbuildExe = Join-Path $msbuild.MSBuildToolsPath "msbuild.exe"
 
 
 # get version
 # get version
 .\nuget.exe install -excludeversion gitversion.commandline -outputdirectory packages
 .\nuget.exe install -excludeversion gitversion.commandline -outputdirectory packages
+.\nuget.exe install -excludeversion SignClient -Version 0.5.0-beta3 -pre -outputdirectory packages
 .\nuget.exe install -excludeversion OpenCover -outputdirectory packages
 .\nuget.exe install -excludeversion OpenCover -outputdirectory packages
 .\nuget.exe install -excludeversion ReportGenerator -outputdirectory packages
 .\nuget.exe install -excludeversion ReportGenerator -outputdirectory packages
 .\nuget.exe install -excludeversion coveralls.io -outputdirectory packages
 .\nuget.exe install -excludeversion coveralls.io -outputdirectory packages
@@ -90,7 +95,28 @@ foreach ($nuspec in $nuspecs)
       $host.SetShouldExit($LastExitCode)
       $host.SetShouldExit($LastExitCode)
     }  
     }  
   }
   }
+}
+
+if($hasSignClientSecret) {
+  Write-Host "Signing Packages" -Foreground Green
+  $nupgks = ls .\artifacts\*.nupkg | Select -ExpandProperty FullName
+
+  foreach ($nupkg in $nupgks) {
+    Write-Host "Submitting $nupkg for signing"
+
+    dotnet $signClientAppPath 'zip' -c $signClientSettings -i $nupkg -s $env:SignClientSecret -n 'Rx.NET' -d 'Reactive Extensions for .NET' -u 'http://reactivex.io/' 
+
+    if ($LastExitCode -ne 0) { 
+        Write-Host "Error signing $nupkg" -Foreground Red
+        if($isAppVeyor) {
+          $host.SetShouldExit($LastExitCode)
+        }  
+    }
+    Write-Host "Finished signing $nupkg"
+  }
 
 
+} else {
+  Write-Host "Client Secret not found, not signing packages"
 }
 }
 
 
 Write-Host "Running tests" -Foreground Green
 Write-Host "Running tests" -Foreground Green

+ 2 - 0
appveyor.ix.yml

@@ -3,6 +3,8 @@ image: Visual Studio 2015
 environment:
 environment:
   COVERALLS_REPO_TOKEN:
   COVERALLS_REPO_TOKEN:
     secure: DOSlU041NY0WKjv9njrNqj14CLEzrF4ogZsbvqIXnNLd492oNlQf4dD5yr7TSK/S
     secure: DOSlU041NY0WKjv9njrNqj14CLEzrF4ogZsbvqIXnNLd492oNlQf4dD5yr7TSK/S
+  SignClientSecret:
+    secure: oR9TMOkkvP/prmXyMT+p6mQhjyw3JDLbuywezBABvXzkvNsdNZgi2yPaHhgaofrb
 
 
 skip_branch_with_pr: true
 skip_branch_with_pr: true
 
 

+ 2 - 0
appveyor.rx.yml

@@ -3,6 +3,8 @@ image: Visual Studio 2015
 environment:
 environment:
   COVERALLS_REPO_TOKEN:
   COVERALLS_REPO_TOKEN:
     secure: DOSlU041NY0WKjv9njrNqj14CLEzrF4ogZsbvqIXnNLd492oNlQf4dD5yr7TSK/S
     secure: DOSlU041NY0WKjv9njrNqj14CLEzrF4ogZsbvqIXnNLd492oNlQf4dD5yr7TSK/S
+  SignClientSecret:
+    secure: oR9TMOkkvP/prmXyMT+p6mQhjyw3JDLbuywezBABvXzkvNsdNZgi2yPaHhgaofrb
 
 
 skip_branch_with_pr: true
 skip_branch_with_pr: true
 
 

+ 2 - 0
appveyor.yml

@@ -3,6 +3,8 @@ image: Visual Studio 2015
 environment:
 environment:
   COVERALLS_REPO_TOKEN:
   COVERALLS_REPO_TOKEN:
     secure: DOSlU041NY0WKjv9njrNqj14CLEzrF4ogZsbvqIXnNLd492oNlQf4dD5yr7TSK/S
     secure: DOSlU041NY0WKjv9njrNqj14CLEzrF4ogZsbvqIXnNLd492oNlQf4dD5yr7TSK/S
+  SignClientSecret:
+    secure: oR9TMOkkvP/prmXyMT+p6mQhjyw3JDLbuywezBABvXzkvNsdNZgi2yPaHhgaofrb
 
 
 skip_branch_with_pr: true
 skip_branch_with_pr: true
 
 

+ 13 - 0
scripts/SignClientSettings.json

@@ -0,0 +1,13 @@
+{
+  "SignClient": {
+    "AzureAd": {
+      "AADInstance": "https://login.microsoftonline.com/",
+      "ClientId": "7ac43fb3-01d7-4bc9-9372-d8064cadeb44",
+      "TenantId": "dotnetfoundation.onmicrosoft.com"
+    },
+    "Service": {
+      "Url": "https://dnfsignservice.azurewebsites.net/",
+      "ResourceId": "http://sign.dotnetfoundation.org/server"
+    }
+  }
+}