-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const { execSync } = require('child_process'); | ||
|
||
|
||
/** | ||
* Custom signing utility | ||
* Required environment variables: | ||
* KEYPAIR_ALIAS - KSP keypair from digicert | ||
* @param config | ||
* @returns {Promise<void>} | ||
*/ | ||
|
||
|
||
// eslint-disable-next-line require-await | ||
exports.default = async (config) => { | ||
const keypairAlias = process.env.KEYPAIR_ALIAS; | ||
const path = config.path ? String(config.path) : ''; | ||
|
||
if (process.platform !== 'win32' || !keypairAlias || !path) { | ||
throw new Error('Either win32, no keypair or path not found'); | ||
} | ||
|
||
const output = execSync( | ||
`smctl sign --keypair-alias=${keypairAlias} --input="${path}" --verbose`, | ||
) | ||
.toString() | ||
.trim(); | ||
|
||
if (!output.includes('Done Adding Additional Store')) { | ||
throw new Error(`Failed to sign executable: ${output}`); | ||
} | ||
}; |