refactor(版本計算流程): 將 main 拆成參數檢查、取得舊版本、計算版本號三階段 #10

Merged
admin merged 3 commits from develop into master 2026-06-30 08:28:58 +00:00
Member

變更摘要

  • main() 流程重新整理為三個明確階段:1. 參數檢查 → 2. 取得舊版本 → 3. 計算版本號,並讓 log.section() 標題與各階段實際工作對齊。
  • version.js 抽出 nextVersion(latest, releases, isBeta),把「計算版本號」這一步從 calculateVersion() 拆出,使「取得舊版本」與「計算版本號」可各自獨立。calculateVersion() 改為組合 latestStableVersion() + nextVersion(),對外行為維持不變。
  • 補上 nextVersion 的單元測試。

影響範圍

  • app/index.jsmain() 階段切分調整;deps 注入由 calculateVersion 改為 latestStableVersion + nextVersion
  • app/version.js:新增並匯出 nextVersioncalculateVersion 改為組合呼叫,行為相容。
  • app/test/version.test.js:新增 2 筆 nextVersion 測試(穩定版與 beta 版)。

風險/注意事項

  • calculateVersion() 輸出與既有測試完全相同(向後相容),無外部行為變更,action 計算版本號邏輯不變。
  • 全測試 45 項通過。
## 變更摘要 - 將 `main()` 流程重新整理為三個明確階段:**1. 參數檢查 → 2. 取得舊版本 → 3. 計算版本號**,並讓 `log.section()` 標題與各階段實際工作對齊。 - 在 `version.js` 抽出 `nextVersion(latest, releases, isBeta)`,把「計算版本號」這一步從 `calculateVersion()` 拆出,使「取得舊版本」與「計算版本號」可各自獨立。`calculateVersion()` 改為組合 `latestStableVersion()` + `nextVersion()`,對外行為維持不變。 - 補上 `nextVersion` 的單元測試。 ## 影響範圍 - `app/index.js`:`main()` 階段切分調整;deps 注入由 `calculateVersion` 改為 `latestStableVersion` + `nextVersion`。 - `app/version.js`:新增並匯出 `nextVersion`;`calculateVersion` 改為組合呼叫,行為相容。 - `app/test/version.test.js`:新增 2 筆 `nextVersion` 測試(穩定版與 beta 版)。 ## 風險/注意事項 - `calculateVersion()` 輸出與既有測試完全相同(向後相容),無外部行為變更,action 計算版本號邏輯不變。 - 全測試 45 項通過。
jiantw83 added 2 commits 2026-06-30 08:17:21 +00:00
admin approved these changes 2026-06-30 08:18:02 +00:00
jiantw83 added 1 commit 2026-06-30 08:28:17 +00:00
admin merged commit a39dfba9da into master 2026-06-30 08:28:58 +00:00
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: old-docker-actions/calculate-version#10