소스 검색

推送tag

黄中银 2 주 전
부모
커밋
9f7f309a5d
1개의 변경된 파일9개의 추가작업 그리고 3개의 파일을 삭제
  1. 9 3
      scripts/set-version.mjs

+ 9 - 3
scripts/set-version.mjs

@@ -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('[警告] 推送失败')