Publishing the website
Deploy the static Astro site to Cloudflare Pages at icons.xerobi.com: project, token, secrets, custom domain and limits.
Last updated
The site (apps/web) is fully static. .github/workflows/deploy-web.yml builds it in GitHub Actions (the icon data needs Python with
skia-pathops, which Cloudflare’s own build image does not have) and uploads apps/web/dist with wrangler pages deploy.
1. One-time setup
-
A Cloudflare account. Note the Account ID (dashboard → any domain or Workers & Pages → right-hand panel).
-
Create the project without deploying (the CI deploy cannot create it interactively):
cd apps/web bunx wrangler login bunx wrangler pages project create xerobi-icons --production-branch mainThe name
xerobi-iconsgiveshttps://icons.xerobi.com. If it is taken, pick another and change--project-nameindeploy-web.yml,apps/web/package.jsonandwrangler.jsonc, and setSITE_URL. -
Create an API token: My Profile → API Tokens → Create Token → Custom, permission Account → Cloudflare Pages → Edit, limited to your account.
-
GitHub → Settings → Secrets and variables → Actions:
- Secrets:
CLOUDFLARE_API_TOKEN,CLOUDFLARE_ACCOUNT_ID. - Variable:
SITE_URL= the public origin, e.g.https://icons.xerobi.com(no trailing slash needed).
- Secrets:
-
First deploy, by hand, to check everything before CI does it:
uv sync --project tooling/generator bun install SITE_URL=https://icons.xerobi.com bun run build --filter=@xerobi/icons-site # icon data, then the site cd apps/web && bunx wrangler pages deploy dist --project-name xerobi-iconsOpen the URL: the home page,
/icons/(search, click an icon, change weight),/icon/house/,/categories/,/404. Check/data/meta.jsonand/sitemap.xmlload.
2. Custom domain: icons.xerobi.com
Pages project → Custom domains → Set up a domain. Cloudflare creates the DNS record if the domain is on Cloudflare; otherwise add the CNAME it shows. Then:
- Set the repository variable
SITE_URLtohttps://icons.xerobi.com. - Re-deploy (push to
main, or run Deploy web manually). Canonical URLs, the sitemap, structured data andllms.txtall followSITE_URL. - Rebuild the Figma plugin with the same
SITE_URL(its manifest allows one origin). - In Search Console / Bing Webmaster Tools, add the property and submit
/sitemap.xml. For IndexNow, the key file isapps/web/public/be7a791bc0f609dd360c321231e28177.txt; generate a new key for a new domain.
3. Every deploy
Automatic: a push to main that touches apps/web, tooling/generator or the root package.json runs Deploy web and publishes to production.
A pull request gets a preview deployment on its own branch URL (when the secrets exist; forks skip the upload but still build).
Run it by hand any time from Actions → Deploy web → Run workflow.
After changing pages, commit apps/web/lastmod.json (the build rewrites it) so search engines learn which pages changed.
Limits to know
| Limit | Value | Where we stand |
|---|---|---|
| Files per deployment | 20,000 on the Free plan (higher on paid plans) | about 6,500 pages and data files: no per-icon SVG files are deployed on purpose |
| Single file size | 25 MiB | the largest data shard is a few MB |
| Builds | done in GitHub Actions, so Cloudflare’s build minutes are not used |
Common errors
| Symptom | Fix |
|---|---|
Project not found in the workflow |
Step 2 was skipped; create the project |
Authentication error [code: 10000] |
The token lacks Cloudflare Pages: Edit, or the account id is wrong |
Build: Missing .../build/icons.json |
The data step did not run: build with bun run build --filter=@xerobi/icons-site from the root (turbo runs it first) |
Pages show links to xerobi-icons.pages.dev instead of icons.xerobi.com |
SITE_URL was not updated, or the deploy did not re-run |
| Figma plugin or other tools blocked by CORS | apps/web/public/_headers must keep Access-Control-Allow-Origin: * on /data/* |
| Deploy succeeds but the old site shows | Browser cache of /site assets; /data/* is cached for an hour by _headers |