Skip to content

Commit

Permalink
Merge pull request #140 from electron/fix-cert-file
Browse files Browse the repository at this point in the history
ci: Properly find Windows codesign certificate
  • Loading branch information
felixrieseberg authored Dec 24, 2018
2 parents aefe273 + 0fced3a commit 74ba7db
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
7 changes: 3 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ init:
install:
# Setup the code signing certificate
- ps: >-
if (Test-Path $env:WINDOWS_CERTIFICATE_P12) {
$filename = Convert-Path .\cert.p12
if (Test-Path Env:\WINDOWS_CERTIFICATE_P12) {
$workingDirectory = Convert-Path (Resolve-Path -path ".")
$filename = "$workingDirectory\cert.p12"
$bytes = [Convert]::FromBase64String($env:WINDOWS_CERTIFICATE_P12)
[IO.File]::WriteAllBytes($filename, $bytes)
$env:WINDOWS_CERTIFICATE_FILE = $filename
}
- ps: Install-Product node $env:nodejs_version x64
- node --version
Expand Down
13 changes: 11 additions & 2 deletions forge.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* tslint:disable */

const path = require('path')
const fs = require('fs')
const packageJson = require('./package.json')

const { version } = packageJson
Expand Down Expand Up @@ -39,6 +40,14 @@ module.exports = {
name: '@electron-forge/maker-squirrel',
platforms: ['win32'],
config: (arch) => {
const certificateFile = process.env.CI
? path.join(__dirname, 'cert.p12')
: process.env.WINDOWS_CERTIFICATE_FILE;

if (!certificateFile || !fs.existsSync(certificateFile)) {
console.warn(`Warning: Could not find certificate file at ${certificateFile}`)
}

return {
name: 'electron-fiddle',
authors: 'Electron Community',
Expand All @@ -49,8 +58,8 @@ module.exports = {
remoteReleases: '',
setupExe: `electron-fiddle-${version}-${arch}-setup.exe`,
setupIcon: path.resolve(iconDir, 'fiddle.ico'),
certificateFile: process.env.WINDOWS_CERTIFICATE_FILE,
certificatePassword: process.env.WINDOWS_CERTIFICATE_PASSWORD
certificatePassword: process.env.WINDOWS_CERTIFICATE_PASSWORD,
certificateFile
}
}
},
Expand Down

0 comments on commit 74ba7db

Please sign in to comment.