-
Notifications
You must be signed in to change notification settings - Fork 95
Change Windows code signing provider to SSL.com #3506
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
Open
jiangxianliang007
wants to merge
2
commits into
nervosnetwork:develop
Choose a base branch
from
jiangxianliang007:chore/windows-signing-sslcom
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+140
−27
Open
Changes from all commits
Commits
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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,16 +1,63 @@ | ||
| const { execSync } = require('node:child_process') | ||
| const path = require('node:path') | ||
|
|
||
| /** | ||
| * Windows code signing with SSL.com eSigner CodeSignTool. | ||
| * | ||
| * Required environment variables: | ||
| * SSL_COM_USERNAME - SSL.com account username | ||
| * SSL_COM_PASSWORD - SSL.com account password | ||
| * SSL_COM_TOTP_SECRET - eSigner TOTP secret (OAuth secret) | ||
| * SSL_COM_MODE - "sandbox" or "product". Defaults to "product". | ||
| * SSL_COM_CREDENTIAL_ID - optional, only needed when the account has multiple certificates | ||
| * CODE_SIGN_TOOL_PATH - directory where CodeSignTool is extracted, e.g. C:\\CodeSignTool | ||
| * | ||
| * When the credentials are absent the signing is skipped instead of failing, so that | ||
| * unsigned test builds (see .github/workflows/package_for_test.yml) still work. | ||
| * The release workflow asserts the credentials exist before packaging, so a release | ||
| * build can never be silently left unsigned. | ||
| */ | ||
| exports.default = async configuration => { | ||
| if (!process.env.SM_API_KEY) { | ||
| console.info(`Skip signing because SM_API_KEY and not configured`) | ||
| const { | ||
| SSL_COM_USERNAME, | ||
| SSL_COM_PASSWORD, | ||
| SSL_COM_TOTP_SECRET, | ||
| SSL_COM_CREDENTIAL_ID, | ||
| SSL_COM_MODE, | ||
| CODE_SIGN_TOOL_PATH, | ||
| } = process.env | ||
|
|
||
| if (!SSL_COM_USERNAME || !SSL_COM_PASSWORD || !SSL_COM_TOTP_SECRET) { | ||
| console.info('Skip signing because SSL.com credentials are not configured') | ||
| return | ||
| } | ||
|
|
||
| if (!configuration.path) { | ||
| throw new Error(`Path of application is not found`) | ||
| } | ||
|
|
||
| execSync(`smctl sign --keypair-alias="${process.env.SM_KEYPAIR_NAME}" --input "${String(configuration.path)}"`, { | ||
| const toolDir = CODE_SIGN_TOOL_PATH || 'C:\\CodeSignTool' | ||
| const toolCmd = path.join(toolDir, 'CodeSignTool.bat') | ||
| const inputPath = path.resolve(String(configuration.path)) | ||
|
|
||
| const args = [ | ||
| 'sign', | ||
| `-username="${SSL_COM_USERNAME}"`, | ||
| `-password="${SSL_COM_PASSWORD}"`, | ||
| `-totp_secret="${SSL_COM_TOTP_SECRET}"`, | ||
| `-input_file_path="${inputPath}"`, | ||
| '-override=true', | ||
| ] | ||
|
|
||
| if (SSL_COM_CREDENTIAL_ID) { | ||
| args.push(`-credential_id="${SSL_COM_CREDENTIAL_ID}"`) | ||
| } | ||
|
|
||
| console.info(`Signing ${inputPath} with SSL.com CodeSignTool`) | ||
|
|
||
| execSync(`"${toolCmd}" ${args.join(' ')}`, { | ||
| cwd: toolDir, | ||
| stdio: 'inherit', | ||
| env: { ...process.env, MODE: SSL_COM_MODE || 'product' }, | ||
| }) | ||
| } | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.