Add certificate to sign files
This commit is contained in:
parent
8916b0c348
commit
747b509a0c
6 changed files with 49 additions and 4 deletions
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
|
|
@ -13,6 +13,7 @@ jobs:
|
||||||
env:
|
env:
|
||||||
solution: AmagnoVirtualPrinter.sln
|
solution: AmagnoVirtualPrinter.sln
|
||||||
configuration: Release
|
configuration: Release
|
||||||
|
certificatepassword: ${{ secrets.CERTIFICATEPASSWORD }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
@ -24,8 +25,11 @@ jobs:
|
||||||
run: msbuild $env:solution /m /t:Restore /p:Configuration=$env:configuration
|
run: msbuild $env:solution /m /t:Restore /p:Configuration=$env:configuration
|
||||||
- name: Build solution
|
- name: Build solution
|
||||||
run: msbuild $env:solution /m /t:Rebuild /p:Configuration=$env:configuration
|
run: msbuild $env:solution /m /t:Rebuild /p:Configuration=$env:configuration
|
||||||
- name: Create msi from PowerShell Script
|
- name: Create msi with PowerShell Script
|
||||||
run: pwsh -command ".\$GITHUB_WORKSPACE\create_msi.ps1"
|
run: pwsh -command ".\$GITHUB_WORKSPACE\create_msi.ps1"
|
||||||
|
- name: Sign msi with PowerShell Script
|
||||||
|
shell: powershell
|
||||||
|
run: .\$GITHUB_WORKSPACE\sign_files.ps1 -Path .\$GITHUB_WORKSPACE\Files -CertPath .\$GITHUB_WORKSPACE\codeSigningCert.pfx -CertPwd $env:SUPER_SECRET
|
||||||
- name: Upload files artifact
|
- name: Upload files artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
|
|
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -236,7 +236,6 @@ ClientBin/
|
||||||
*.dbmdl
|
*.dbmdl
|
||||||
*.dbproj.schemaview
|
*.dbproj.schemaview
|
||||||
*.jfm
|
*.jfm
|
||||||
*.pfx
|
|
||||||
*.publishsettings
|
*.publishsettings
|
||||||
orleans.codegen.cs
|
orleans.codegen.cs
|
||||||
|
|
||||||
|
|
|
||||||
BIN
codeSigningCert.pfx
Normal file
BIN
codeSigningCert.pfx
Normal file
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
||||||
Set-Location $PSScriptRoot
|
Set-Location $PSScriptRoot
|
||||||
|
|
||||||
$args = "/MSBUILD:$PSScriptRoot\Installer\AmagnoVirtualPrinter.WixSharpInstaller", "/p:$PSScriptRoot"
|
$arguments = "/MSBUILD:$PSScriptRoot\Installer\AmagnoVirtualPrinter.WixSharpInstaller", "/p:$PSScriptRoot"
|
||||||
Remove-Item -Path "$PSScriptRoot\Files\*" -Filter '*.pdb' -Force
|
Remove-Item -Path "$PSScriptRoot\Files\*" -Filter '*.pdb' -Force
|
||||||
Start-Process -FilePath "$PSScriptRoot\Files\AmagnoPrinterInstaller.exe" -ArgumentList $args -wait
|
Start-Process -FilePath "$PSScriptRoot\Files\AmagnoPrinterInstaller.exe" -ArgumentList $arguments -wait
|
||||||
26
sign_files.ps1
Normal file
26
sign_files.ps1
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
[CmdletBinding()]
|
||||||
|
param (
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[String]
|
||||||
|
$path,
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[String]
|
||||||
|
$certPath,
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[String]
|
||||||
|
$certPwd
|
||||||
|
)
|
||||||
|
|
||||||
|
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2($certPath, $certPwd)
|
||||||
|
|
||||||
|
$files = Get-ChildItem -Path $path |
|
||||||
|
Where-Object { $_.Extension -in '.dll', '.exe' } |
|
||||||
|
Select-Object -ExpandProperty FullName |
|
||||||
|
Get-AuthenticodeSignature |
|
||||||
|
Where-Object { $_.Status -eq "NotSigned" } |
|
||||||
|
Select-Object -ExpandProperty Path
|
||||||
|
|
||||||
|
foreach($file in $files){
|
||||||
|
Write-Host "Signing... $file"
|
||||||
|
Set-AuthenticodeSignature $file -Certificate $cert -TimestampServer "http://timestamp.digicert.com"
|
||||||
|
}
|
||||||
16
sign_setup.ps1
Normal file
16
sign_setup.ps1
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
[CmdletBinding()]
|
||||||
|
param (
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[String]
|
||||||
|
$certPath,
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[String]
|
||||||
|
$certPwd
|
||||||
|
)
|
||||||
|
|
||||||
|
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2($certPath, $certPwd)
|
||||||
|
|
||||||
|
$file = "AmagnoPrinterInstaller.msi"
|
||||||
|
|
||||||
|
Write-Host "Signing... $file"
|
||||||
|
Set-AuthenticodeSignature $file -Certificate $cert -TimestampServer "http://timestamp.digicert.com"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue