Deploy to Cloudflare Workers: content-addressed assets, staged preview tests, rollback notes

This commit is contained in:
ZacharyZhang-NY committed 2026-10-11 17:23:34 -04:00
1 parent 83bc28c087
commit 3630bf2a27
10 files changed
+1667 -23

No files matched your search

Executable
+23
View File
@@ -0,0 +1,23 @@
#!/bin/sh
# Uploads a version, tests its preview URL, then promotes it.
set -eu
cd "$(dirname "$0")"
if [ -n "$(git status --porcelain)" ]; then
echo "deploy: commit first; each version names its commit" >&2
exit 1
fi
./build.sh
rev=$(git rev-parse --short HEAD)
out=$(npx wrangler versions upload --message "$rev")
echo "$out"
id=$(echo "$out" | sed -n 's/^Worker Version ID: //p')
preview=$(echo "$out" | sed -n 's/^Version Preview URL: //p')
if [ -z "$id" ] || [ -z "$preview" ]; then
echo "deploy: wrangler printed no version id or preview URL" >&2
exit 1
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://#')
BASE_URL=$site npx playwright test
echo "deploy: $rev live at $site (version $id)"