diff --git a/appveyor12.yml b/appveyor12.yml index b08dfe989..c465b6993 100644 --- a/appveyor12.yml +++ b/appveyor12.yml @@ -44,6 +44,9 @@ environment: before_build: - nuget restore - ps: .\prebuild.ps1 +- ps: [System.Convert]::FromBase64String($env:CertificatePassword) | set-content "greenshot.pfx" -encoding byte +- ps: $psw = ConvertTo-SecureString $env:my_secure_var -AsPlainText +- ps: Import-PfxCertificate -FilePath Greenshot.pfx -CertStoreLocation cert:\CurrentUser\My -Password $psw build: project: greenshot.sln verbosity: normal diff --git a/build.ps1 b/build.ps1 index d894d5003..2478628a0 100644 --- a/build.ps1 +++ b/build.ps1 @@ -36,6 +36,7 @@ $gitcommit=$env:APPVEYOR_REPO_COMMIT if ( !$gitcommit ) { $gitcommit = "abcdefghijklmnopqrstuvwxy" } + $gitcommit=$gitcommit.SubString(0, [math]::Min($gitcommit.Length, 7)) $detailversion=$version + '-' + $gitcommit + " " + $buildType $release=(([version]$version).build) % 2 -eq 1 @@ -51,16 +52,6 @@ Function MD5($filename) { return [System.BitConverter]::ToString($hash) -replace "-", "" } -# Write the certificate to the file system, so signtool can use it -Function PrepareCertificate() { - $decodedContentBytes = [System.Convert]::FromBase64String($env:Certificate) - $decodedContentBytes | set-content "greenshot.pfx" -encoding byte - #$certutilArguments = @('-p', $env:CertificatePassword, '-importpfx', "greenshot.pfx") - #Start-Process -wait certutil -ArgumentList $certutilArguments -NoNewWindow - $secureString = ConvertTo-SecureString $env:CertificatePassword -AsPlainText -Force - Import-PfxCertificate -FilePath .\Greenshot.pfx -CertStoreLocation Cert:\CurrentUser\My -Password $secureString -} - # Sign the specify file Function SignWithCertificate($filename) { Write-Host "Signing $filename" @@ -325,9 +316,6 @@ FillTemplates echo "Generating MD5" MD5Checksums | Set-Content "$(get-location)\Greenshot\bin\Release\checksum.MD5" -encoding UTF8 -echo "Preparing certificate" -PrepareCertificate - echo "Signing executables" SignBinaryFilesBeforeBuildingInstaller