Skip to content

Commit

Permalink
workflow: recover version when git commit fails
Browse files Browse the repository at this point in the history
  • Loading branch information
cloydlau committed Dec 17, 2023
1 parent f6b20df commit dce6d6d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/release.mts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ async function release() {
return
}
if (spawn.sync('git', ['commit', '-m', `release: v${targetVersion}`], { stdio: 'inherit' }).status === 1) {
// pre-commit 时如果 lint 失败,则恢复版本号
pkg.version = currentVersion
fs.writeFileSync('./package.json', JSON.stringify(pkg, null, 2))
return
}

Expand All @@ -135,9 +138,6 @@ async function release() {

console.log(cyan('Publishing...'))
if (spawn.sync('npm', ['publish', '--registry=https://registry.npmjs.org'], { stdio: 'inherit' }).status === 1) {
// 恢复版本号
// pkg.version = currentVersion
// fs.writeFileSync('./package.json', JSON.stringify(pkg, null, 2))
return
}

Expand Down

0 comments on commit dce6d6d

Please sign in to comment.