-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from pusher/develop
Strong naming
- Loading branch information
Showing
13 changed files
with
167 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,11 +13,16 @@ jobs: | |
- uses: actions/checkout@v2 | ||
- name: Setup MS Build | ||
uses: microsoft/[email protected] | ||
- name: Write code signing key | ||
env: | ||
CI_CODE_SIGN_KEY: ${{ secrets.CI_CODE_SIGN_KEY }} | ||
run: | | ||
./StrongName/WritePusherKey.ps1 | ||
- name: Restore dependencies | ||
run: nuget restore pusher-dotnet-server.sln | ||
- name: Build | ||
run: msbuild /p:deterministic=true /p:msbuildArchitecture=x64 /p:configuration=Release pusher-dotnet-server.sln | ||
run: msbuild /p:SignAssembly=true /p:deterministic=true /p:msbuildArchitecture=x64 /p:configuration=Release pusher-dotnet-server.sln | ||
- name: Pack | ||
run: msbuild /t:Pack /p:configuration=release PusherServer/PusherServer.csproj | ||
run: msbuild /t:Pack /p:SignAssembly=true /p:configuration=release PusherServer/PusherServer.csproj | ||
- name: Publish | ||
run: nuget push PusherServer\bin\release\PusherServer.*.nupkg -NonInteractive -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NUGET_API_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Test signing | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: [ master, develop ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: windows-2019 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup MS Build | ||
uses: microsoft/[email protected] | ||
- name: Write code signing key | ||
env: | ||
CI_CODE_SIGN_KEY: ${{ secrets.CI_CODE_SIGN_KEY }} | ||
run: | | ||
./StrongName/WritePusherKey.ps1 | ||
- name: Restore dependencies | ||
run: nuget restore pusher-dotnet-server.sln | ||
- name: Build | ||
run: msbuild /p:SignAssembly=true /p:deterministic=true /p:msbuildArchitecture=x64 /p:configuration=Release pusher-dotnet-server.sln | ||
- name: Pack | ||
run: msbuild /t:Pack /p:SignAssembly=true /p:configuration=release PusherServer/PusherServer.csproj | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("PusherServer.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100456864dbf1cbca1cfaca7dc1af4103e2fc957a7db4e525dd577054d01d7974a75a201a3c4856a513603ee24d893cfebb17199a2c9cd1a677d86f07ee612e21aff7c5c4f507872d343c93875a353b76f8c1d0b937cc563f0e361580940bb7a759739be3dce880f62cff52e36698efc38895b7cde9bc984c95b443075dbc8cf7dd")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
$ErrorActionPreference = "stop"; | ||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition; | ||
Push-Location $scriptDir; | ||
try { | ||
$keyName = "PusherServer"; | ||
.\GenerateStrongNameKey.cmd "$keyName" | ||
$keyBytes = [System.IO.File]::ReadAllBytes("$scriptDir\\$keyName.snk"); | ||
$keyBase64 = [System.Convert]::ToBase64String($keyBytes); | ||
Write-Output ""; | ||
Write-Output "Base 64 encoded signing key:"; | ||
Write-Output $keyBase64; | ||
} | ||
finally { | ||
Pop-Location | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
@if '%1' == '' GOTO EXIT_WITH_ERROR | ||
|
||
@set "WIP_FILE=C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" | ||
@if exist %WIP_FILE% ( | ||
@call "%WIP_FILE%" | ||
GOTO GENERATE_SNK | ||
) | ||
|
||
@set "WIP_FILE=%VS150COMNTOOLS%\vsvars32.bat" | ||
@if exist "%WIP_FILE%" ( | ||
@call "%WIP_FILE%" | ||
GOTO GENERATE_SNK | ||
) | ||
|
||
@set "WIP_FILE=%VS140COMNTOOLS%\vsvars32.bat" | ||
@if exist %WIP_FILE% ( | ||
@call "%WIP_FILE%" | ||
GOTO GENERATE_SNK | ||
) | ||
|
||
@set "WIP_FILE=%VS130COMNTOOLS%\vsvars32.bat" | ||
@if exist %WIP_FILE% ( | ||
@call "%WIP_FILE%" | ||
GOTO GENERATE_SNK | ||
) | ||
|
||
@set "WIP_FILE=%VS120COMNTOOLS%\vsvars32.bat" | ||
@if exist %WIP_FILE% ( | ||
@call "%WIP_FILE%" | ||
GOTO GENERATE_SNK | ||
) | ||
|
||
@set "WIP_FILE=%VS110COMNTOOLS%\vsvars32.bat" | ||
@if exist %WIP_FILE% ( | ||
@call "%WIP_FILE%" | ||
GOTO GENERATE_SNK | ||
) | ||
|
||
@set "WIP_FILE=%VS100COMNTOOLS%\vsvars32.bat" | ||
@if exist %WIP_FILE% ( | ||
@call "%WIP_FILE%" | ||
GOTO GENERATE_SNK | ||
) | ||
|
||
:GENERATE_SNK | ||
sn -k "%~1.snk" | ||
sn -p "%~1.snk" "%~1.public.snk" | ||
sn -tp "%~1.public.snk" | ||
exit /B 0 | ||
|
||
:EXIT_WITH_ERROR | ||
@echo Please provide a strong name key file name as a parameter to this command file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
$ErrorActionPreference = "stop"; | ||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition; | ||
Push-Location $scriptDir | ||
try { | ||
$keyText = $Env:CI_CODE_SIGN_KEY; | ||
if ($keyText) { | ||
$key = [System.Convert]::FromBase64String($keyText); | ||
$fileInfo = [System.IO.FileInfo]::new("$scriptDir\..\PusherServer.snk"); | ||
[System.IO.File]::WriteAllBytes($fileInfo.FullName, $key) | Out-Null; | ||
} | ||
else { | ||
throw "The environment variable CI_CODE_SIGN_KEY is undefined. It needs to be a base 64 encoded key."; | ||
} | ||
} | ||
finally { | ||
Pop-Location; | ||
} |