This commit is contained in:
Fox_block
2026-03-14 18:57:51 +08:00
parent 94d853f9d1
commit 0e3b333071
2 changed files with 1 additions and 7 deletions
-6
View File
@@ -9,12 +9,6 @@ if (!version) {
process.exit(1) process.exit(1)
} }
const semverRe = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/
if (!semverRe.test(version)) {
process.stderr.write(`非法版本号:${version}\n`)
process.exit(1)
}
const pkgPath = path.join(process.cwd(), 'package.json') const pkgPath = path.join(process.cwd(), 'package.json')
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8')) const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'))
pkg.version = version pkg.version = version
+1 -1
View File
@@ -16,7 +16,7 @@ const message = String(rawMessage || '').trim()
// 是否以 release: 开头 // 是否以 release: 开头
const isReleasePrefix = /^release:/i.test(message) const isReleasePrefix = /^release:/i.test(message)
const semverRe = /\bv?(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)\b/ const semverRe = /\bv?(\S+)/
const versionMatch = message.match(semverRe) const versionMatch = message.match(semverRe)
const version = versionMatch ? versionMatch[1] : '' const version = versionMatch ? versionMatch[1] : ''