GitHub Pages deployment for Miris demos.
Live at: https://miris.astralcity.studio
npm run build
cp -r deploy/* /Users/roberto/io/git/astralcity/miris/stress-test/
cd /Users/roberto/io/git/astralcity/miris
git add -A && git commit -m "update" && git push
GitHub Pages deploys automatically on push (~30 seconds).
Create a new folder at the root (e.g. my-demo/) and copy your built files into it. It will be available at https://miris.astralcity.studio/my-demo/.
GitHub Pages has a 100MB repo size limit, so large files (USDZ models) cannot be committed here.
Large assets are uploaded as GitHub Release assets in a separate public repo:
v1.0.0-assetshttps://github.com/Astral-City/demo-assets/releases/download/v1.0.0-assets/<filename>.usdzGitHub Release download URLs don’t include CORS headers, so browsers block fetch() requests to them. A Cloudflare Worker acts as a CORS proxy:
https://gh-cors-proxy.astral-city-assets.workers.dev/<filename>wrangler from a simple worker.js (see below)src/assets.js)const ASSET_MODE = "github"; // "local" for quick testing with files in public/usdz/
function assetUrl(filename) {
if (ASSET_MODE === "local") return `./usdz/${filename}`;
if (import.meta.env.DEV) return `/gh-assets/${filename}`; // Vite proxy (local dev)
return `https://gh-cors-proxy.astral-city-assets.workers.dev/${filename}`; // Production
}
/gh-assets/* to GitHub Releases server-side (no CORS issues).usdz filegh release upload v1.0.0-assets myfile.usdz --repo Astral-City/demo-assets
assets.js:
usdz: assetUrl("myfile.usdz"),
Deployed at gh-cors-proxy.astral-city-assets.workers.dev. To redeploy or modify:
cd /tmp/gh-cors-proxy
npx wrangler deploy
Worker code:
const GITHUB_RELEASE =
"https://github.com/Astral-City/demo-assets/releases/download/v1.0.0-assets";
export default {
async fetch(request) {
const url = new URL(request.url);
const filename = url.pathname.slice(1);
if (!filename) return new Response("Usage: /<filename>", { status: 400 });
if (request.method === "OPTIONS") return new Response(null, { headers: corsHeaders() });
const resp = await fetch(`${GITHUB_RELEASE}/${filename}`, { redirect: "follow" });
if (!resp.ok) return new Response("Not found", { status: resp.status, headers: corsHeaders() });
return new Response(resp.body, {
status: 200,
headers: {
...corsHeaders(),
"content-type": resp.headers.get("content-type") || "application/octet-stream",
"content-length": resp.headers.get("content-length"),
"cache-control": "public, max-age=86400",
},
});
},
};
function corsHeaders() {
return {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, HEAD, OPTIONS",
"Access-Control-Allow-Headers": "*",
};
}
CNAME file at the root — do not delete it.roberto.cascavilla@astralcity.studio’s account.demo-assets repo is public so GitHub Release URLs are accessible. The assets are 3D demo models — publicly visible on the demo page anyway.