@@ -19124,7 +19124,7 @@ function parseWindowsSignMode(raw) {
1912419124 `windows-sign-mode must be one of: none | signtool | trusted-signing. Got "${raw}".`
1912519125 );
1912619126}
19127- async function runCheckedTool(deps, command, args, label, opts = {}) {
19127+ async function runCheckedTool(command, args, label, deps , opts = {}) {
1912819128 deps.logger.info(`[pkg-action] ${label}: ${command} ${args.join(" ")}`);
1912919129 let result = await deps.exec(command, args, {
1913019130 ignoreReturnCode: !0,
@@ -19133,32 +19133,31 @@ async function runCheckedTool(deps, command, args, label, opts = {}) {
1913319133 if (result.exitCode !== 0)
1913419134 throw new SignError(`${label} failed (exit ${String(result.exitCode)}). See stderr above.`);
1913519135}
19136- async function writeSecretBase64(deps, tempDir, base64, extension) {
19137- let path4 = join6(tempDir, `${randomBytes(8).toString("hex")}.${extension}`), bytes = Buffer.from(base64, "base64");
19136+ async function writeSecretBase64(base64, extension, deps ) {
19137+ let path4 = join6(deps. tempDir, `${randomBytes(8).toString("hex")}.${extension}`), bytes = Buffer.from(base64, "base64");
1913819138 return await (deps.writeFile ?? ((p, d) => writeFile4(p, d, { mode: 384 })))(path4, bytes), path4;
1913919139}
1914019140async function signMacos(binaryPath, cfg, deps) {
1914119141 let keychainPath = join6(
1914219142 deps.tempDir,
1914319143 `pkg-action-${randomBytes(6).toString("hex")}.keychain-db`
19144- ), p12Path = await writeSecretBase64(deps, deps.tempDir, cfg.certificate, "p12");
19144+ ), p12Path = await writeSecretBase64(cfg.certificate, "p12", deps );
1914519145 await runCheckedTool(
19146- deps,
1914719146 "security",
1914819147 ["create-keychain", "-p", cfg.keychainPassword, keychainPath],
19149- "security create-keychain"
19148+ "security create-keychain",
19149+ deps
1915019150 ), await runCheckedTool(
19151- deps,
1915219151 "security",
1915319152 ["set-keychain-settings", "-lut", "21600", keychainPath],
19154- "security set-keychain-settings"
19153+ "security set-keychain-settings",
19154+ deps
1915519155 ), await runCheckedTool(
19156- deps,
1915719156 "security",
1915819157 ["unlock-keychain", "-p", cfg.keychainPassword, keychainPath],
19159- "security unlock-keychain"
19158+ "security unlock-keychain",
19159+ deps
1916019160 ), await runCheckedTool(
19161- deps,
1916219161 "security",
1916319162 [
1916419163 "import",
@@ -19172,9 +19171,9 @@ async function signMacos(binaryPath, cfg, deps) {
1917219171 "-T",
1917319172 "/usr/bin/security"
1917419173 ],
19175- "security import"
19174+ "security import",
19175+ deps
1917619176 ), await runCheckedTool(
19177- deps,
1917819177 "security",
1917919178 [
1918019179 "set-key-partition-list",
@@ -19185,7 +19184,8 @@ async function signMacos(binaryPath, cfg, deps) {
1918519184 cfg.keychainPassword,
1918619185 keychainPath
1918719186 ],
19188- "security set-key-partition-list"
19187+ "security set-key-partition-list",
19188+ deps
1918919189 );
1919019190 let codesignArgs = [
1919119191 "--force",
@@ -19197,13 +19197,12 @@ async function signMacos(binaryPath, cfg, deps) {
1919719197 "--sign",
1919819198 cfg.identity
1919919199 ];
19200- return cfg.entitlements !== void 0 && codesignArgs.push("--entitlements", cfg.entitlements), codesignArgs.push(binaryPath), await runCheckedTool(deps, "codesign", codesignArgs, "codesign"), await runCheckedTool(
19201- deps,
19200+ return cfg.entitlements !== void 0 && codesignArgs.push("--entitlements", cfg.entitlements), codesignArgs.push(binaryPath), await runCheckedTool("codesign", codesignArgs, "codesign", deps), await runCheckedTool(
1920219201 "codesign",
1920319202 ["--verify", "--strict", "--verbose=2", binaryPath],
19204- "codesign --verify"
19203+ "codesign --verify",
19204+ deps
1920519205 ), cfg.notarize && (await runCheckedTool(
19206- deps,
1920719206 "xcrun",
1920819207 [
1920919208 "notarytool",
@@ -19217,13 +19216,14 @@ async function signMacos(binaryPath, cfg, deps) {
1921719216 cfg.appPassword,
1921819217 "--wait"
1921919218 ],
19220- "xcrun notarytool submit"
19219+ "xcrun notarytool submit",
19220+ deps
1922119221 ), deps.logger.info(
1922219222 "[pkg-action] notarytool submit succeeded. Note: bare binaries cannot be stapled; Gatekeeper queries Apple at first launch."
1922319223 )), { keychainPath };
1922419224}
1922519225async function signWindowsSigntool(binaryPath, cfg, deps) {
19226- let pfxPath = await writeSecretBase64(deps, deps.tempDir, cfg.certificate, "pfx"), args = [
19226+ let pfxPath = await writeSecretBase64(cfg.certificate, "pfx", deps ), args = [
1922719227 "sign",
1922819228 "/fd",
1922919229 "sha256",
@@ -19236,7 +19236,7 @@ async function signWindowsSigntool(binaryPath, cfg, deps) {
1923619236 "/p",
1923719237 cfg.password
1923819238 ];
19239- cfg.description !== void 0 && args.push("/d", cfg.description), args.push(binaryPath), await runCheckedTool(deps, "signtool", args, "signtool sign"), await runCheckedTool(deps, "signtool", ["verify", "/pa", "/v", binaryPath], "signtool verify");
19239+ cfg.description !== void 0 && args.push("/d", cfg.description), args.push(binaryPath), await runCheckedTool("signtool", args, "signtool sign", deps ), await runCheckedTool("signtool", ["verify", "/pa", "/v", binaryPath], "signtool verify", deps );
1924019240}
1924119241async function signWindowsTrustedSigning(binaryPath, cfg, deps) {
1924219242 let env = {
@@ -19256,7 +19256,7 @@ async function signWindowsTrustedSigning(binaryPath, cfg, deps) {
1925619256 "-fd",
1925719257 "sha256"
1925819258 ];
19259- cfg.description !== void 0 && args.push("-d", cfg.description), args.push(binaryPath), await runCheckedTool(deps, "azuresigntool", args, "azuresigntool sign", { env }), await runCheckedTool(deps, "signtool", ["verify", "/pa", "/v", binaryPath], "signtool verify");
19259+ cfg.description !== void 0 && args.push("-d", cfg.description), args.push(binaryPath), await runCheckedTool("azuresigntool", args, "azuresigntool sign", deps, { env }), await runCheckedTool("signtool", ["verify", "/pa", "/v", binaryPath], "signtool verify", deps );
1926019260}
1926119261
1926219262// packages/core/src/version.ts
0 commit comments