|
|
@@ -245,13 +245,19 @@ function gitTag(version) {
|
|
|
}
|
|
|
|
|
|
// Git 推送(包含 tags)
|
|
|
-function gitPush() {
|
|
|
+function gitPush(version) {
|
|
|
try {
|
|
|
// 确保终端处于正常模式,以便 git 可以进行交互
|
|
|
if (process.stdin.isTTY) {
|
|
|
process.stdin.setRawMode(false)
|
|
|
}
|
|
|
- execSync('git push --follow-tags', {
|
|
|
+ // 先推送提交
|
|
|
+ execSync('git push', {
|
|
|
+ encoding: 'utf-8',
|
|
|
+ stdio: 'inherit'
|
|
|
+ })
|
|
|
+ // 再单独推送 tag(强制更新远程 tag)
|
|
|
+ execSync(`git push origin v${version} --force`, {
|
|
|
encoding: 'utf-8',
|
|
|
stdio: 'inherit'
|
|
|
})
|
|
|
@@ -366,7 +372,7 @@ async function main() {
|
|
|
if (pushChoice) {
|
|
|
console.log('')
|
|
|
console.log('正在推送...')
|
|
|
- if (gitPush()) {
|
|
|
+ if (gitPush(newVersion)) {
|
|
|
console.log('[成功] 已推送到远程仓库')
|
|
|
} else {
|
|
|
console.log('[警告] 推送失败')
|