refactor(release-cleanup): 將清理邏輯由 bash 改寫為 Node.js 模組

依功能分組為 logger/validate/config/gitea-client/releases/tags 模組,
entrypoint.sh 改為呼叫 node /app/index.js,Dockerfile 改用 node:20-alpine 基底。
對外行為(清理舊 release 與未指定 release 的 tag)維持不變。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jeffery
2026-06-26 10:35:19 +08:00
co-authored by Claude Opus 4.8
parent b478872c5f
commit b1aa8730a2
10 changed files with 377 additions and 179 deletions
+53
View File
@@ -0,0 +1,53 @@
// 統一的主控台輸出格式,對應原本 entrypoint.sh 的 separator/section/info/... 等函式。
const LINE = '=================================================='
const SUBLINE = '--------------------------------------------------'
/**
* 在前後換行的情況下輸出一條等號分隔線至 stdout,用於視覺上區隔不同階段的輸出。
*/
export function separator() {
process.stdout.write(`\n${LINE}\n`)
}
/**
* 輸出一個區段標題:先印分隔線,再印標題文字與一條虛線,用於標示流程進入新階段。
* @param {string} title 區段標題文字
*/
export function section(title) {
separator()
process.stdout.write(`${title}\n`)
process.stdout.write(`${SUBLINE}\n`)
}
/**
* 以 `[INFO]` 前綴輸出一般資訊訊息至 stdout。
* @param {string} message 訊息內容
*/
export function info(message) {
process.stdout.write(`[INFO] ${message}\n`)
}
/**
* 以 `[OK]` 前綴輸出成功訊息至 stdout(前綴補空白以與其他標籤對齊)。
* @param {string} message 訊息內容
*/
export function success(message) {
process.stdout.write(`[OK] ${message}\n`)
}
/**
* 以 `[WARN]` 前綴輸出警告訊息;為與一般輸出同流,仍寫入 stdout。
* @param {string} message 訊息內容
*/
export function warn(message) {
process.stdout.write(`[WARN] ${message}\n`)
}
/**
* 以 `[ERR]` 前綴輸出錯誤訊息至 stderr(唯一寫入 stderr 的輸出函式)。
* @param {string} message 訊息內容
*/
export function fail(message) {
process.stderr.write(`[ERR] ${message}\n`)
}