ci: prune assets older than 30 days after deploy

This commit is contained in:
Timi
2026-11-07 16:58:29 +08:00
parent 24a19ff538
commit d2870b5cc1
+11
View File
@@ -82,6 +82,17 @@ jobs:
echo "index.html:$(stat -c '%y %s 字节' "$target/index.html")"
echo "assets 数量:$(find "$target/assets" -type f 2>/dev/null | wc -l)"
- name: Prune old assets
if: steps.guard.outputs.skip != 'true'
run: |
target=/mnt/nginx-html/gao
before=$(du -sm "$target" | cut -f1)
# 只删 30 天前的,本次复制的文件 mtime 是构建时间,不受影响
# APK 用本地包不请求这些文件,Web 的 index.html 是 no-cache,风险窗口只有长期不刷新
deleted=$(find "$target/assets" -type f -mtime +30 -print -delete 2>/dev/null | wc -l)
after=$(du -sm "$target" | cut -f1)
echo "清理 $deleted 个 30 天前的文件,体积 ${before}MB → ${after}MB"
- name: Verify
if: steps.guard.outputs.skip != 'true'
run: |