- 新增 purge-cache 步骤,在 deploy-pages 完成后自动调用 API 刷新全站缓存 - 彻底解决新版发布后,由于 CDN 强缓存导致浏览器请求旧 JS 文件报 404(Failed to fetch dynamically imported module)的版本偏差问题 - 优化流水线执行顺序,将缓存清理与 Telegram 成功通知配置为并行执行,避免增加构建耗时 - 更新失败通知的依赖项,并优化了发布成功的通知文案
This commit is contained in:
1 parent
19606301de
commit
be0ba73edf
1 file changed
+19
-1
+19
-1
@@ -91,6 +91,22 @@ steps:
|
|||||||
- corepack enable
|
- corepack enable
|
||||||
- pnpm exec wrangler pages deploy .svelte-kit/cloudflare --project-name=blogflare --branch=main
|
- 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
|
- name: notify-success
|
||||||
image: appleboy/drone-telegram
|
image: appleboy/drone-telegram
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -109,7 +125,7 @@ steps:
|
|||||||
|
|
||||||
🔗 <b>构建详情:</b> <a href="{{ build.link }}">查看 Drone 运行记录</a>
|
🔗 <b>构建详情:</b> <a href="{{ build.link }}">查看 Drone 运行记录</a>
|
||||||
|
|
||||||
🚀 全套改动现已全网完成发布部署!
|
🚀 全套改动现已全网完成发布部署!(缓存清理已在后台同步执行)
|
||||||
when:
|
when:
|
||||||
status:
|
status:
|
||||||
- success
|
- success
|
||||||
@@ -117,7 +133,9 @@ steps:
|
|||||||
- name: notify-failure
|
- name: notify-failure
|
||||||
image: appleboy/drone-telegram
|
image: appleboy/drone-telegram
|
||||||
depends_on:
|
depends_on:
|
||||||
|
- deploy-db
|
||||||
- deploy-pages
|
- deploy-pages
|
||||||
|
- purge-cache
|
||||||
settings:
|
settings:
|
||||||
token:
|
token:
|
||||||
from_secret: TELEGRAM_BOT_TOKEN
|
from_secret: TELEGRAM_BOT_TOKEN
|
||||||
|
|||||||
Reference in new issue
Block a user