diff --git a/scripts/release.ts b/scripts/release.ts index 8969389..c3915d9 100644 --- a/scripts/release.ts +++ b/scripts/release.ts @@ -104,7 +104,7 @@ async function stepGitCommitTag(version: string): Promise { }); const statusOutput = await new Response(statusProc.stdout).text(); const statusLines = statusOutput.trim().split("\n").filter(Boolean); - const nonPkgChanges = statusLines.filter((line) => !line.includes("package.json")); + const nonPkgChanges = statusLines.filter((line) => !/^[?MADRCU ]{2} package\.json$/.test(line)); if (nonPkgChanges.length > 0) { throw new Error("工作区有其他未提交变更,请先清理后再运行 release"); } @@ -139,9 +139,12 @@ async function stepGitCommitTag(version: string): Promise { } // git tag - const tagProc = Bun.spawn(["git", "tag", `v${version}`], { - stdio: ["inherit", "inherit", "inherit"], - }); + const tagProc = Bun.spawn( + ["git", "tag", "-a", `v${version}`, "-m", `chore: release v${version}`], + { + stdio: ["inherit", "inherit", "inherit"], + }, + ); const tagExit = await tagProc.exited; if (tagExit !== 0) { throw new Error("git tag 失败");