update build.ts

This commit is contained in:
2026-02-09 01:27:21 +08:00
parent a610bd371d
commit e61b21f000
2 changed files with 20 additions and 13 deletions

View File

@@ -18,12 +18,12 @@
}, },
"build.ts": { "build.ts": {
"script_name": "build.ts", "script_name": "build.ts",
"script_length": 5127, "script_length": 5442,
"script_sha256": "ac5a94ad2a52efb8ec16619f9166e7a473848dfebda8a904216a21790e16ee62", "script_sha256": "88e86c845c6cd11e3fc8a42c36a5f62c71dae3f3fb1610938eee8848eb8c0423",
"script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/build.ts", "script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/build.ts",
"single_script_file": true, "single_script_file": true,
"publish_time": 1770564482429, "publish_time": 1770564482429,
"update_time": 1770570335255 "update_time": 1770571637371
}, },
"cal-bun.ts": { "cal-bun.ts": {
"script_name": "cal-bun.ts", "script_name": "cal-bun.ts",

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env runts -- --allow-all #!/usr/bin/env runts -- --allow-all
import { import {
execCommandAndStdout, execCommand,
execCommandShell, execCommandShell,
existsPath, existsPath,
log, log,
@@ -148,15 +148,22 @@ async function buildFile(file: string, flags: any) {
if (flags["skip-sign"]) { if (flags["skip-sign"]) {
log.warn(`Skip signature for file: ${bundleFile}`); log.warn(`Skip signature for file: ${bundleFile}`);
} else { } else {
const signScriptUserPin = await execCommandAndStdout("keyring.rs", [ const signScriptUserPinOutput = await execCommand("keyring.rs", [
"-gRU", "-gRU",
"yubikey4white:user-pin", "yubikey:script-sign",
]);
const ret = await execCommandShell("script-sign.rs", [
"--pin",
signScriptUserPin,
bundleFile,
]); ]);
const scriptSignArgs: string[] = [];
if (signScriptUserPinOutput.code !== 0) {
log.warn(`Read script sign PIN failed: `, signScriptUserPinOutput);
} else {
scriptSignArgs.push("--pin");
scriptSignArgs.push(
signScriptUserPinOutput.getStdoutAsStringThenTrim(),
);
}
scriptSignArgs.push(bundleFile);
const ret = await execCommandShell("script-sign.rs", scriptSignArgs);
if (ret !== 0) { if (ret !== 0) {
log.error(`Sign script: ${bundleFile} failed, ret code: ${ret}`); log.error(`Sign script: ${bundleFile} failed, ret code: ${ret}`);
return; return;
@@ -168,5 +175,5 @@ async function buildFile(file: string, flags: any) {
await main(); await main();
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260209T010454+08:00.MEYCIQCyqK8SqFbxJqCu1fEP // @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260209T012700+08:00.MEUCIGGCDSJvi+URM4KdfZrW
// IAOM2DklduDdgQ3i//kMBKfUQAIhAPq5xxr5jGvJ6YdpoLr9t95b+JTmSZ+gJq4kEH3XrRLm // q04x43Wf4KDFnpuRUJVJp97GAiEAyoTJKX/S7K1/1czB3U6+bKurCgxcG/09AXJSSHSTSo0=