Single combined staging deploy workflow (site + edge script) - #14
Merged
Conversation
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
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 tomain— that triggers the production deploy. And the edge-script deploy workflow previously lived on the feature branch, so it couldn't be dispatched frommain.This PR adds a single workflow that takes a
refinput (any branch/tag/SHA). Run it pointing atgeo-localized-pricingand it deploys both the site and the edge script to staging. Merging this PR tomainis safe: it only adds/replaces a workflow file, prod is untouched.What it does
Two jobs run in parallel:
pnpm build→ uploadsdist/toshroud-email-website-stagingstorage zone → purges pull zone cachedeno check→deno task build→ uploadsedge-script/dist/index.tsto bunny edge scriptingBoth check out the
refyou specify.Usage
Actions tab → "Deploy to staging" → Run workflow → enter
geo-localized-pricingas the ref.Verified
Secrets (all already present)
BUNNY_STAGING_STORAGE_PASSWORD,BUNNY_STAGING_PULLZONE_ID,BUNNY_STAGING_SCRIPT_ID,BUNNY_STAGING_DEPLOY_KEY,BUNNY_API_KEY