From be0ba73edf1216e584367cc6a961470d602fe140 Mon Sep 17 00:00:00 2001 From: seaHi Date: Sat, 26 Sep 2026 15:15:22 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E9=83=A8=E7=BD=B2=E5=AE=8C=E6=AF=95?= =?UTF-8?q?=E5=90=8E=E8=87=AA=E5=8A=A8=E6=B8=85=E7=90=86=20Cloudflare=20?= =?UTF-8?q?=E8=BE=B9=E7=BC=98=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 purge-cache 步骤,在 deploy-pages 完成后自动调用 API 刷新全站缓存 - 彻底解决新版发布后,由于 CDN 强缓存导致浏览器请求旧 JS 文件报 404(Failed to fetch dynamically imported module)的版本偏差问题 - 优化流水线执行顺序,将缓存清理与 Telegram 成功通知配置为并行执行,避免增加构建耗时 - 更新失败通知的依赖项,并优化了发布成功的通知文案 --- .drone.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index d32a653..08936c4 100644 --- a/.drone.yml +++ b/.drone.yml @@ -91,6 +91,22 @@ steps: - corepack enable - pnpm exec wrangler pages deploy .svelte-kit/cloudflare --project-name=blogflare --branch=main + - name: purge-cache + image: curlimages/curl:8.1.2 + depends_on: + - deploy-pages + environment: + CLOUDFLARE_API_TOKEN: + from_secret: CLOUDFLARE_API_TOKEN + CLOUDFLARE_ZONE_ID: + from_secret: CLOUDFLARE_ZONE_ID + commands: + - | + curl -s -S -X POST "https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE_ID/purge_cache" \ + -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \ + -H "Content-Type: application/json" \ + --data '{"purge_everything":true}' + - name: notify-success image: appleboy/drone-telegram depends_on: @@ -109,7 +125,7 @@ steps: 🔗 构建详情: 查看 Drone 运行记录 - 🚀 全套改动现已全网完成发布部署! + 🚀 全套改动现已全网完成发布部署!(缓存清理已在后台同步执行) when: status: - success @@ -117,7 +133,9 @@ steps: - name: notify-failure image: appleboy/drone-telegram depends_on: + - deploy-db - deploy-pages + - purge-cache settings: token: from_secret: TELEGRAM_BOT_TOKEN