Cloudflare and GitHub Pages
rista setup writes the files a host needs into the site. It does not deploy
anything. A GitHub Actions workflow builds the site on every push to main
and hands the result to the host.
bundle exec rista setup cloudflare
bundle exec rista setup github-pages
A file that is already there is kept. Pass --force to replace it. Each
command ends with a list of what is left to do by hand.
Cloudflare
Cloudflare serves a directory of files from a Worker, for free. It serves
/blog from blog/index.html, redirects /blog/ to /blog, and answers a
missing path with the nearest 404.html and status 404, as rista serve
does.
rista setup cloudflare writes three files:
| File | What it does |
|---|---|
wrangler.jsonc | names the Worker and points it at out/ |
public/_headers | caches the hashed files under /assets/ forever |
.github/workflows/cloudflare.yml | builds the site and runs wrangler deploy |
--name sets the name of the Worker, which is the name of the site’s
directory by default. The site is served at <name>.<account>.workers.dev
until it gets a domain in the Cloudflare dashboard.
Left to do:
- Create a Cloudflare API token from the “Edit Cloudflare Workers” template.
- Add
CLOUDFLARE_API_TOKENandCLOUDFLARE_ACCOUNT_IDas secrets of the repository on GitHub. - Run
bundle lock --add-platform x86_64-linux-gnu, so the workflow can install the gems.
To deploy from your own machine, without the workflow:
bundle exec rista build
npx wrangler deploy
Connecting the repository in the Cloudflare dashboard does not work. Cloudflare’s own build has no ImageMagick, which a Rista site needs.
GitHub Pages
rista setup github-pages writes .github/workflows/github-pages.yml, which
builds the site and publishes it.
Left to do:
- On GitHub, set Settings > Pages > Source to “GitHub Actions”.
- Run
bundle lock --add-platform x86_64-linux-gnu. - A site at
https://<user>.github.io/<repo>is under a sub-path. Setbase "/<repo>/assets/"inklenod.config.rb, and that address as:urlinsrc/site.rb.
GitHub Pages differs from the other hosts in two ways:
- It redirects
/blogto/blog/when the file isblog/index.html. So the workflow builds with--flat, which writesblog.html. GitHub Pages serves that at/blogas it is. - It answers every missing path with the top-level
404.html. A not-found page in a subdirectory is not used.
Flat files
bundle exec rista build --flat
| Path | Default | With --flat |
|---|---|---|
/ | index.html | index.html |
/blog | blog/index.html | blog.html |
/blog/2026 | blog/2026/index.html | blog/2026.html |
Everything else is written the same. Use it for a host that serves
blog.html at /blog. The config from rista nginx expects the default
layout.
A site in a subdirectory
GitHub reads workflows from .github/workflows at the root of the
repository. When the site is in a subdirectory, rista setup writes the
workflow to the root and makes its steps run in the site’s directory. The
other files stay with the site.
Other CI
The workflows are for GitHub Actions. Elsewhere, install Ruby, the ImageMagick and OpenSSL headers, and run:
bundle install
bundle exec rista build
npx wrangler deploy