From 003b6f3bdbdb2fed1fe4be18b4643bacce5f19be Mon Sep 17 00:00:00 2001 From: mac Date: Mon, 29 Jun 2026 17:02:55 +0800 Subject: [PATCH] =?UTF-8?q?fix(deploy):=20cleanup=20=E6=8C=89=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=97=B6=E9=97=B4=E6=8E=92=E5=BA=8F=EF=BC=8C=E9=98=B2?= =?UTF-8?q?=E5=AD=97=E6=AF=8D=E5=BA=8F=E8=AF=AF=E5=88=A0=E6=96=B0=20releas?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 原 find + sort(字母序)导致 a 开头的 commit sha 被误判为最旧版本删除。 改为 ls -dt(按修改时间倒序),tail -n +6 保留最近 5 个。 --- .gitea/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 9ebbf00..2428a50 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -83,7 +83,7 @@ jobs: fi echo "=== 7. Cleanup old releases ===" - find "${DEPLOY_BASE}/releases" -mindepth 1 -maxdepth 1 -type d | sort | head -n -5 | xargs -r rm -rf + ls -dt "${DEPLOY_BASE}"/releases/*/ | tail -n +6 | xargs -r rm -rf echo "=== 8. Cleanup temp ===" rm -rf "${CLONE_DIR}"