fix: 精确匹配 package.json 状态行,使用 annotated tag
This commit is contained in:
@@ -104,7 +104,7 @@ async function stepGitCommitTag(version: string): Promise<void> {
|
||||
});
|
||||
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<void> {
|
||||
}
|
||||
|
||||
// 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 失败");
|
||||
|
||||
Reference in New Issue
Block a user