Skip to content

Add staging deploy workflow + parameterize storage zone - #11

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

Add staging deploy workflow + parameterize storage zone#11
taobojlen merged 1 commit into
mainfrom
staging-deploy-infra

Conversation

@taobojlen

Copy link
Copy Markdown
Member

What

Split out from #10 so the staging deploy action can be merged and used independently of the geo-pricing feature. Merge this first.

  • scripts/deploy-bunny.mjs — add BUNNY_STORAGE_ZONE env var (defaults to shroud-email-website, so production is unchanged). Set it to shroud-email-website-staging for staging deploys.
  • .github/workflows/deploy-staging.yml — manual-dispatch workflow that builds the site and uploads to the shroud-email-website-staging storage zone, then purges the staging pull zone cache.

No behavior change to the production deploy.yml — it doesn't set BUNNY_STORAGE_ZONE, so it keeps using the default.

Why split

Manual workflows (workflow_dispatch) only run from main, so the staging deploy action needs to be on main before it can be used to test #10.

Required staging secrets

Repo → Settings → Secrets → Actions:

Secret Value
BUNNY_STAGING_STORAGE_PASSWORD staging storage zone read/write password
BUNNY_STAGING_PULLZONE_ID staging pull zone id (for cache purge)
BUNNY_API_KEY account API key (already exists, for cache purge)

Verified

  • node --check scripts/deploy-bunny.mjs
  • Production deploy.yml unaffected (no BUNNY_STORAGE_ZONE → uses default)

Introduce a manual staging deploy path so site builds can be pushed to a
separate storage zone for testing, without touching production.

- deploy-bunny.mjs: add BUNNY_STORAGE_ZONE env var (defaults to
  shroud-email-website, so production is unchanged). Set it to
  shroud-email-website-staging for staging deploys.
- deploy-staging.yml: manual-dispatch workflow that builds the site and uploads
  to the shroud-email-website-staging storage zone, then purges the staging
  pull zone cache.

No behavior change to the production deploy.yml.

Required staging secrets: BUNNY_STAGING_STORAGE_PASSWORD,
BUNNY_STAGING_PULLZONE_ID, BUNNY_API_KEY.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
shroud-email-website b3fb847 Jul 24 2026, 02:26 PM

@taobojlen
taobojlen merged commit 05172d4 into main Jul 24, 2026
1 of 2 checks passed
@taobojlen
taobojlen deleted the staging-deploy-infra branch July 24, 2026 14:38
taobojlen added a commit that referenced this pull request Jul 24, 2026
Display 25 pounds/year to UK visitors and $35/year to everyone else by
rewriting the price at the edge based on the bunny CDN-RequestCountryCode
header.

Website changes:
- Pricing.vue: wrap price strings in <span data-price=""> markers; the edge
  script targets these for rewriting.
- 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 script using servePullZone + HTMLRewriter. Non-UK visitors get
  $35/year; UK/unknown visitors see the 25 pounds/year default baked into the
  HTML (safe degradation if the script is disabled).
- Bundled to a single file via esbuild + @luca/esbuild-deno-loader (mirrors
  the official BunnyWay template).

Deploy:
- deploy-edge-script.yml: type-check + bundle + upload the edge script to a
  staging edge script id (BUNNY_STAGING_SCRIPT_ID / BUNNY_STAGING_DEPLOY_KEY).

Staging deploy infra (storage zone parameterization + deploy-staging workflow)
arrives via #11, already merged to main.
taobojlen added a commit that referenced this pull request Jul 24, 2026
Display 25 pounds/year to UK visitors and $35/year to everyone else by
rewriting the price at the edge based on the bunny CDN-RequestCountryCode
header.

Website changes:
- Pricing.vue: wrap price strings in <span data-price=""> markers; the edge
  script targets these for rewriting.
- 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 script using servePullZone + HTMLRewriter. Non-UK visitors get
  $35/year; UK/unknown visitors see the 25 pounds/year default baked into the
  HTML (safe degradation if the script is disabled).
- Bundled to a single file via esbuild + @luca/esbuild-deno-loader (mirrors
  the official BunnyWay template).

Deploy:
- deploy-edge-script.yml: type-check + bundle + upload the edge script to a
  staging edge script id (BUNNY_STAGING_SCRIPT_ID / BUNNY_STAGING_DEPLOY_KEY).

Staging deploy infra (storage zone parameterization + deploy-staging workflow)
arrives via #11, already merged to main.
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