Skip to content

Commit

Permalink
Add code signing scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Oren Novotny committed Sep 16, 2016
1 parent 371c83c commit 2b4bf46
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 2 deletions.
28 changes: 27 additions & 1 deletion Ix.NET/Source/build-new.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ $nuspecDir = Join-Path $scriptPath "NuSpecs"
$isAppVeyor = Test-Path -Path env:\APPVEYOR
$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
md -Force $outputLocation | Out-Null
$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
md -Force $outputLocation | Out-Null

Expand All @@ -24,6 +28,7 @@ $msbuildExe = Join-Path $msbuild.MSBuildToolsPath "msbuild.exe"

# get tools
.\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 ReportGenerator -outputdirectory packages
.\nuget.exe install -excludeversion coveralls.io -outputdirectory packages
Expand Down Expand Up @@ -74,7 +79,28 @@ foreach ($nuspec in $nuspecs) {
$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
Expand Down
28 changes: 27 additions & 1 deletion Rx.NET/Source/build-new.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ $isAppVeyor = Test-Path -Path env:\APPVEYOR
$outputLocation = Join-Path $scriptPath "testResults"
$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
md -Force $outputLocation | Out-Null
$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
md -Force $outputLocation | Out-Null

Expand All @@ -24,6 +28,7 @@ $msbuildExe = Join-Path $msbuild.MSBuildToolsPath "msbuild.exe"

# get version
.\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 ReportGenerator -outputdirectory packages
.\nuget.exe install -excludeversion coveralls.io -outputdirectory packages
Expand Down Expand Up @@ -90,7 +95,28 @@ foreach ($nuspec in $nuspecs)
$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
Expand Down
2 changes: 2 additions & 0 deletions appveyor.ix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ image: Visual Studio 2015
environment:
COVERALLS_REPO_TOKEN:
secure: DOSlU041NY0WKjv9njrNqj14CLEzrF4ogZsbvqIXnNLd492oNlQf4dD5yr7TSK/S
SignClientSecret:
secure: oR9TMOkkvP/prmXyMT+p6mQhjyw3JDLbuywezBABvXzkvNsdNZgi2yPaHhgaofrb

skip_branch_with_pr: true

Expand Down
2 changes: 2 additions & 0 deletions appveyor.rx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ image: Visual Studio 2015
environment:
COVERALLS_REPO_TOKEN:
secure: DOSlU041NY0WKjv9njrNqj14CLEzrF4ogZsbvqIXnNLd492oNlQf4dD5yr7TSK/S
SignClientSecret:
secure: oR9TMOkkvP/prmXyMT+p6mQhjyw3JDLbuywezBABvXzkvNsdNZgi2yPaHhgaofrb

skip_branch_with_pr: true

Expand Down
2 changes: 2 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ image: Visual Studio 2015
environment:
COVERALLS_REPO_TOKEN:
secure: DOSlU041NY0WKjv9njrNqj14CLEzrF4ogZsbvqIXnNLd492oNlQf4dD5yr7TSK/S
SignClientSecret:
secure: oR9TMOkkvP/prmXyMT+p6mQhjyw3JDLbuywezBABvXzkvNsdNZgi2yPaHhgaofrb

skip_branch_with_pr: true

Expand Down
13 changes: 13 additions & 0 deletions scripts/SignClientSettings.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}

0 comments on commit 2b4bf46

Please sign in to comment.