Skip to content

Commit db6393e

Browse files
committed
chore(build): allow prepare-version on non-tag branches
- 在 normalizeTagToVersion 中忽略 main 等非 semver 输入 - 使 main 分支及手动触发 workflow 不再因版本校验失败而中断
1 parent 25357c8 commit db6393e

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

deploy/prepare-version.mjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ function normalizeTagToVersion(input) {
2222
const v = raw.startsWith('v') ? raw.slice(1) : raw;
2323
// Basic semver-ish validation: 1.2.3 or 1.2.3-rc.1(+build ignored)
2424
if (!/^\d+\.\d+\.\d+([\-+].+)?$/.test(v)) {
25-
throw new Error(`Invalid version/tag "${raw}". Expected like v1.2.3 or 1.2.3`);
25+
// 在非版本分支(如 main)上运行时,允许跳过版本更新,而不是直接报错中断 CI
26+
console.log(
27+
`[prepare-version] Ignore non-version input "${raw}". Expected like v1.2.3 or 1.2.3`
28+
);
29+
return null;
2630
}
2731
return v;
2832
}

0 commit comments

Comments
 (0)