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
+22
View File
@@ -0,0 +1,22 @@
// 進入點:載入設定、建立 Gitea 客戶端,依序清理舊成品與孤立 tag。
import { loadConfig } from './config.js'
import { GiteaClient } from './gitea-client.js'
import { cleanupReleases } from './releases.js'
import { cleanupOrphanTags } from './tags.js'
import { separator, fail } from './logger.js'
async function main() {
const config = loadConfig()
const client = new GiteaClient({ token: config.token })
await cleanupReleases(client, config)
await cleanupOrphanTags(client, config)
separator()
}
main().catch((error) => {
fail(error.message)
process.exit(1)
})