From 08e19833a204cc9516b2487040c9a15622270e86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Sun, 11 Oct 2026 17:27:01 -0400 Subject: [PATCH] Deploy waits until the live site serves the new build --- web/deploy.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/web/deploy.sh b/web/deploy.sh index 3051200..b8bb44b 100755 --- a/web/deploy.sh +++ b/web/deploy.sh @@ -19,5 +19,15 @@ fi BASE_URL=$preview npx playwright test npx wrangler versions deploy "$id@100%" --yes --message "$rev" site=$(echo "$preview" | sed 's#https://[0-9a-f]*-#https://#') +main=$(sed -n 's#.*src="\(a/main\.[0-9a-f]*\.js\)".*#\1#p' dist/index.html) +tries=0 +until curl -fs "$site/" | grep -q "$main"; do + tries=$((tries + 1)) + if [ "$tries" -ge 30 ]; then + echo "deploy: $site still serves an older build than $main" >&2 + exit 1 + fi + sleep 2 +done BASE_URL=$site npx playwright test echo "deploy: $rev live at $site (version $id)"