-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: sign windows exe #65
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,147 @@ | ||
const { execSync } = require('child_process'); | ||
|
||
const config = { | ||
productName: 'Decentraland Launcher', | ||
artifactName: 'Decentraland Launcher-${os}-${arch}.${ext}', | ||
executableName: 'Decentraland Launcher', | ||
directories: { | ||
output: 'dist', | ||
buildResources: 'buildResources', | ||
}, | ||
files: ['packages/**/dist/**'], | ||
win: { | ||
publisherName: 'Decentraland Foundation', | ||
appId: 'Decentraland.Launcher', | ||
icon: 'buildResources/icon.ico', | ||
target: [ | ||
{ | ||
target: 'nsis', | ||
arch: ['x64'], | ||
}, | ||
], | ||
verifyUpdateCodeSignature: false, | ||
signAndEditExecutable: true, | ||
signingHashAlgorithms: ['sha256'], | ||
rfc3161TimeStampServer: 'http://ts.ssl.com', | ||
timeStampServer: 'http://ts.ssl.com', | ||
extraResources: ['buildResources/icon.ico'], | ||
}, | ||
nsis: { | ||
allowElevation: true, | ||
allowToChangeInstallationDirectory: true, | ||
createDesktopShortcut: true, | ||
oneClick: false, | ||
perMachine: true, | ||
deleteAppDataOnUninstall: true, | ||
include: 'buildResources/scripts/windowsInstaller.nsh', | ||
installerSidebar: 'buildResources/background.bmp', | ||
installerIcon: 'buildResources/icon.ico', | ||
}, | ||
mac: { | ||
appId: 'com.Decentraland.Launcher', | ||
icon: 'buildResources/icon.icns', | ||
target: [ | ||
{ | ||
target: 'default', | ||
arch: ['x64', 'arm64'], | ||
}, | ||
], | ||
hardenedRuntime: true, | ||
entitlements: 'buildResources/entitlements.mac.plist', | ||
extendInfo: [ | ||
{ | ||
NSMicrophoneUsageDescription: 'Need microphone access to use voice chat in the application', | ||
}, | ||
], | ||
extraResources: ['icon.icns'], | ||
}, | ||
dmg: { | ||
title: 'Decentraland Launcher Installer', | ||
background: 'buildResources/background.png', | ||
window: { | ||
width: 714, | ||
height: 472, | ||
}, | ||
contents: [ | ||
{ | ||
x: 230, | ||
y: 215, | ||
type: 'file', | ||
}, | ||
{ | ||
x: 460, | ||
y: 215, | ||
type: 'link', | ||
path: '/Applications', | ||
}, | ||
], | ||
}, | ||
publish: [ | ||
{ | ||
provider: 'github', | ||
vPrefixedTagName: false, | ||
}, | ||
], | ||
protocols: [ | ||
{ | ||
name: 'decentraland', | ||
schemes: ['decentraland'], | ||
}, | ||
], | ||
}; | ||
|
||
// Sign Windows .exe | ||
if (process.env.CODE_SIGN_SCRIPT_PATH) { | ||
config.win.sign = configuration => { | ||
console.log('Requested signing for ', configuration.path); | ||
|
||
// Only proceed if the installer .exe file is in the configuration path - skip signing everything else | ||
if (!configuration.path.endsWith('Decentraland Launcher-win-x64.exe')) { | ||
console.log('This is not the installer .exe, skip signing'); | ||
return true; | ||
} | ||
|
||
const scriptPath = process.env.CODE_SIGN_SCRIPT_PATH; | ||
|
||
try { | ||
// Execute the sign script synchronously | ||
process.env.INPUT_COMMAND = 'sign'; // override the INPUT_COMMAND, it is already set in the "env" of the GitHub Action step, but for some reason it gets overwritten with 'npx electron-builder ...' so we must set it to 'sign' | ||
process.env.INPUT_FILE_PATH = configuration.path; // set the file path to the installer .exe | ||
const env = { | ||
command: process.env.INPUT_COMMAND, | ||
username: process.env.INPUT_USERNAME, | ||
password: process.env.INPUT_PASSWORD, | ||
credential_id: process.env.INPUT_CREDENTIAL_ID, | ||
totp_secret: process.env.INPUT_TOTP_SECRET, | ||
file_path: process.env.INPUT_FILE_PATH, | ||
output_path: process.env.INPUT_OUTPUT_PATH, | ||
malware_block: process.env.INPUT_MALWARE_BLOCK, | ||
override: process.env.INPUT_OVERRIDE, | ||
clean_logs: process.env.INPUT_CLEAN_LOGS, | ||
environment_name: process.env.INPUT_ENVIRONMENT_NAME, | ||
jvm_max_memory: process.env.INPUT_JVM_MAX_MEMORY, | ||
}; | ||
console.log('env:', JSON.stringify(env, null, 2)); | ||
const output = execSync(`node "${scriptPath}"`, { | ||
env: { ...process.env, ...env }, | ||
}).toString(); | ||
console.log(`Script output: ${output}`); | ||
} catch (error) { | ||
console.error(`Error executing script: ${error.message}`); | ||
if (error.stdout) { | ||
console.log(`Script stdout: ${error.stdout.toString()}`); | ||
} | ||
if (error.stderr) { | ||
console.error(`Script stderr: ${error.stderr.toString()}`); | ||
} | ||
return false; | ||
} | ||
|
||
return true; // Return true at the end of successful signing | ||
}; | ||
|
||
// sign only for Windows 10 and above - adjust for your code as needed | ||
config.win.signingHashAlgorithms = ['sha256']; | ||
} | ||
|
||
module.exports = config; |
This file was deleted.
Oops, something went wrong.
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue that
electron-builder
had withnpx
has been fixed in npm v10.1.0Reference: electron-userland/electron-builder#6411 (comment)