Skip to content

Single combined staging deploy workflow (site + edge script) - #14

Merged
taobojlen merged 1 commit into
mainfrom
combined-staging-deploy
Jul 24, 2026
Merged

Single combined staging deploy workflow (site + edge script)#14
taobojlen merged 1 commit into
mainfrom
combined-staging-deploy

Conversation

@taobojlen

Copy link
Copy Markdown
Member

What

One manual workflow that deploys everything needed to test staging in a single run — the static site build AND the bunny.net edge script — so you can test a feature branch end-to-end before merging to main (prod).

Why

PR #10 (geo-localized-pricing) can't be tested by merging to main — that triggers the production deploy. And the edge-script deploy workflow previously lived on the feature branch, so it couldn't be dispatched from main.

This PR adds a single workflow that takes a ref input (any branch/tag/SHA). Run it pointing at geo-localized-pricing and it deploys both the site and the edge script to staging. Merging this PR to main is safe: it only adds/replaces a workflow file, prod is untouched.

What it does

Two jobs run in parallel:

  1. Deploy sitepnpm build → uploads dist/ to shroud-email-website-staging storage zone → purges pull zone cache
  2. Deploy edge scriptdeno checkdeno task build → uploads edge-script/dist/index.ts to bunny edge scripting

Both check out the ref you specify.

Usage

Actions tab → "Deploy to staging" → Run workflow → enter geo-localized-pricing as the ref.

Verified

  • YAML valid ✅
  • zizmor ✅ (no findings)

Secrets (all already present)

BUNNY_STAGING_STORAGE_PASSWORD, BUNNY_STAGING_PULLZONE_ID, BUNNY_STAGING_SCRIPT_ID, BUNNY_STAGING_DEPLOY_KEY, BUNNY_API_KEY

One manual workflow that deploys everything needed to test staging: the static
site build AND the bunny.net edge script, in parallel jobs. Takes a 'ref' input
so you can point it at any branch (e.g. geo-localized-pricing) and test before
merging to main.

Replaces the standalone deploy-staging.yml (site only). The edge-script deploy
previously lived only on the feature branch and couldn't be dispatched from
main; it's now folded into this workflow.
@taobojlen
taobojlen merged commit 2dfeed5 into main Jul 24, 2026
1 check passed
@taobojlen
taobojlen deleted the combined-staging-deploy branch July 24, 2026 16:04
taobojlen added a commit that referenced this pull request Jul 24, 2026
Show £25/year to UK visitors and $35/year to everyone else, dynamically based
on the visitor's country, rewritten at the bunny.net edge.

Website changes:
- Pricing.vue: hero heading + price table cell show a single £25/year default,
  wrapped in <span data-price=""> markers (the edge script's rewrite targets).
- pricing.astro: drop client:load on the Pricing component. It is purely
  presentational, so static rendering avoids a hydration snap-back that would
  overwrite the edge-rewritten price. Also ships no JS for the page.
- tsconfig.json: exclude edge-script/ from astro check (it has its own Deno
  type-check; the bundled output was producing spurious TS errors).

Edge script (edge-script/):
- Middleware using servePullZone + HTMLRewriter. Non-UK visitors get
  $35/year; UK/unknown visitors see the £25/year default baked into the HTML
  (safe degradation if the script is disabled or the country header is missing).
- Sets Cache-Control: no-store on HTML responses so the per-visitor rewrite
  isn't cached and served to a visitor in the other region. Static assets keep
  their original cache headers.
- Bundled to a single file via esbuild + @luca/esbuild-deno-loader (mirrors
  the official BunnyWay template).

Deploy: handled by the combined "Deploy to staging" workflow on main (PR #14),
which deploys both the site and the edge script in one run.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant