This repository contains the migration-ready version of the USTC Astro Coffee Break site.
app.pykeeps the existing FastAPI server mode for voting, ratings, notes, Benty-Fields updates, and admin actions.build_static.pyexports a read-only GitHub Pages version undersite/.
The static site includes papers, history, summary pages, figures, and poster slideshows. Write actions are hidden in the static build.
python3 -m venv .venv
.venv/bin/python -m pip install -r requirements-static.txt
.venv/bin/python build_static.pyOpen site/index.html to inspect the static mirror.
Enable Pages with GitHub Actions as the source. The workflow
.github/workflows/pages.yml builds site/ and deploys it on every push to
main.
If the Cloudflare Worker voting API is deployed, add this repository variable:
COFFEE_API_BASE, for examplehttps://coffee-break-api.<subdomain>.workers.dev
Configure the repository secret:
BENTY_PASSWORD
Then run .github/workflows/update-agenda.yml manually or on its weekly
schedule. It refreshes data/, rebuilds static manifests, and commits changed
data back to the repository.
The static GitHub Pages site can keep the in-page voting experience through a
Cloudflare Worker + D1 backend under worker/.
Cloudflare setup:
cd worker
cp wrangler.toml.example wrangler.toml
# Fill database_id after creating the D1 database.
npx wrangler d1 create coffee-break-db
npx wrangler d1 migrations apply coffee-break-db --remoteGitHub repository secrets for Deploy Cloudflare Worker:
CLOUDFLARE_API_TOKENCLOUDFLARE_ACCOUNT_ID
Cloudflare Worker variables/secrets:
ALLOWED_ORIGINS: include the GitHub Pages URLCOFFEE_VOTE_CODE: optional weekly passcodeADMIN_TOKEN: optional admin refresh tokenIP_HASH_SECRET: optional salt for IP-based rate limitingMAX_VOTES_PER_MINUTE: optional, defaults to12
The Worker implements:
GET /coffee_votes/currentPOST /coffee_votes/currentPOST /coffee_votes/current/cancelPOST /admin/refresh_votes?token=...
Responses match the old FastAPI shape, so the same coffee order page works in server mode and static GitHub Pages mode.
The Reset coffee orders workflow archives and clears current orders on the
same weekly schedule as the paper agenda update, and can also be run manually.
Set the GitHub repository secret COFFEE_ADMIN_TOKEN to the same value as the
Worker ADMIN_TOKEN.
coffee_break_poster is currently a Codex skill, not a command that GitHub
Actions can call directly. To run it in Actions, convert the skill workflow into
a repository script that accepts paper IDs, reads data/*.md and
data/figs/<arxiv_id>/, calls a model API with the poster prompt, and writes
poster images or HTML into data/posters/current/.
The current repository already supports static poster display through
data/posters/<week>/manifest.json; the missing piece is the generator script.
Recommended tags:
git tag server-current-2026-08-22 0eb72c2
git tag pages-v1GitHub Pages can be rolled back by redeploying a previous commit or tag.