Bläddra i källkod

feat: 更新部署脚本,调整版本号升级顺序

liujia 2 månader sedan
förälder
incheckning
f126757a62
1 ändrade filer med 8 tillägg och 8 borttagningar
  1. 8 8
      scripts/release.js

+ 8 - 8
scripts/release.js

@@ -23,19 +23,19 @@ async function main() {
     },
   ])
 
-  // 2. 全量生成 changelog
+  // 2. 先更新版本号(生成新 tag)
+  run(`npm version ${versionType} -m "new version published: v%s"`)
+
+  // 3. 全量生成 changelog(覆盖原文件)
   console.log('📝 正在全量生成 changelog...')
   run('npx conventional-changelog -p angular -i CHANGELOG.md -s -r 0')
 
-  // 3. 自动提交 changelog
+  // 4. 自动提交 changelog
   run('git add CHANGELOG.md')
-  run('git commit -m "chore: update changelog"')
-
-  // 4. 更新版本号
-  run(`npm version ${versionType} -m "new version published: v%s"`)
+  run('git commit --amend --no-edit') // 直接加到刚才的版本提交里
 
-  // 5. 推送代码 & tag
-  run('git push')
+  // 5. 推送代码 & tag(tag 不变,提交更新了)
+  run('git push --force-with-lease')
   run('git push --tags')
 
   console.log('✅ 发布完成!')