Selaa lähdekoodia

feat: 更新部署脚本

liujia 2 kuukautta sitten
vanhempi
commit
c8d9c5adcf
1 muutettua tiedostoa jossa 9 lisäystä ja 9 poistoa
  1. 9 9
      scripts/release.js

+ 9 - 9
scripts/release.js

@@ -14,7 +14,7 @@ function getVersion() {
 async function main() {
   console.log('🚀 开始发布流程...')
 
-  // 1. 选择版本类型(默认 minor
+  // 1. 选择版本类型(默认 patch
   const { versionType } = await inquirer.prompt([
     {
       type: 'list',
@@ -29,11 +29,7 @@ async function main() {
     },
   ])
 
-  // 2. 更新版本号并生成 tag(保证 changelog 最新)
-  run(`npm version ${versionType} -m "new version published: v%s"`)
-  const version = getVersion()
-
-  // 3. 选择日志生成模式(默认增量)
+  // 2. 选择日志生成模式(默认 incremental)
   const { changelogMode } = await inquirer.prompt([
     {
       type: 'list',
@@ -47,7 +43,7 @@ async function main() {
     },
   ])
 
-  // 4. 根据模式生成 changelog
+  // 3. 先生成 changelog
   console.log('📝 正在生成 changelog...')
   if (changelogMode === 'full') {
     run('npx conventional-changelog -p angular -i CHANGELOG.md -s -r 0')
@@ -55,9 +51,13 @@ async function main() {
     run('npx conventional-changelog -p angular -i CHANGELOG.md -s')
   }
 
-  // 5. 将 changelog 合并到刚才的版本提交里
+  // 4. 提交 changelog
   run('git add CHANGELOG.md')
-  run('git commit --amend --no-edit')
+  run('git commit -m "chore: update changelog"')
+
+  // 5. 更新版本号并生成 tag
+  run(`npm version ${versionType} -m "new version published: v%s"`)
+  const version = getVersion()
 
   // 6. 推送代码 & tag
   run('git push --follow-tags')