Skip to content
botBehaviorPublic

About

Deploy a built static site to Cloudflare Workers static assets, from Rust. No wrangler, no Node.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

edgepub

Deploy a built static site to Cloudflare Workers static assets, from Rust. No wrangler, no Node.

Every deploy is a new Worker version. edgepub checks the live site against your build, and if anything is wrong it puts the previous version back.

edgepub planning a site, deploying it and verifying it at its domain, then rolling back a deploy whose verification failed

What it does

  • Uploads only what's new. Files are hashed the way Cloudflare's asset manifest expects, and only the ones Cloudflare doesn't already have are sent.
  • Deploys a version. _headers and _redirects go in the version's asset config, so headers and redirects change atomically with the files.
  • Verifies the live site. It fetches a sample of pages from your domain and checks, for each one:
    • the body matches the local file byte for byte (it retries while the new version propagates)
    • every stylesheet, script and image the page references loads
    • every header _headers promises for that path is there with the same value, and headers removed with ! Name are gone
  • Rolls back. If verification fails, the version that was live before is redeployed, and edgepub exits 1.
  • Keeps workers.dev off unless you turn it on, so your domain is the only address.

Quick start

cargo install --git https://github.com/botBehavior/edgepub
edgepub plan   public --config edgepub.toml   # local and read-only: files, hashes, parsed _headers
edgepub deploy public --config edgepub.toml
# edgepub.toml
account_id = "…"
worker = "my-site"
token_file = "~/.config/edgepub/token"   # chmod 600
workers_dev = false                      # also serve on <worker>.<subdomain>.workers.dev
verify_url = "https://example.com"       # where to verify; defaults to workers.dev when that's on
# compatibility_date = "2026-11-01"
# html_handling = "auto-trailing-slash"
# not_found_handling = "404-page"
# verify_sample = 12                     # HTML pages checked per deploy, plus the home page and a few assets

The token needs one permission: Account › Workers Scripts › Edit, limited to your account. edgepub reads it from token_file at deploy time and refuses a file that anyone else can read.

Your domain is attached to the Worker once, in the dashboard (Workers › your worker › Domains). After that, point verify_url at it.

The last line of output is always edgepub: …, and the exit code is 0 only for a verified deploy, so other tools can drive it. hypomnema uses it as its deploy step.

_headers

edgepub reads the subset of _headers that Workers static assets supports: literal paths and a trailing *, Name: value to set a header, and ! Name to remove one set by an earlier rule. That's enough for a per-page policy:

/*
  Content-Security-Policy: default-src 'self'; script-src 'none'

/posts/islands/*
  ! Content-Security-Policy
  Content-Security-Policy: default-src 'self'; script-src 'self' 'wasm-unsafe-eval'

Syntax it can't model (placeholders, a * mid-path) is refused at plan, not guessed at.

Tested against Cloudflare

Run against a real account before release:

  • an assets-only Worker (no script) is accepted
  • a ! Content-Security-Policy override replaces the site-wide policy on its path, and other headers still apply
  • workers.dev can be switched off per Worker
  • a redeploy with nothing changed uploads nothing
  • a failed verification rolls back to the previous version

Limits

  • Workers static assets only: no Worker script, bindings or Durable Objects yet. The config is meant to grow to carry them.
  • 25 MiB per file, Cloudflare's limit.
  • Linux and macOS (the token file permission check is Unix).

Built with

reqwest, sha2, tokio, walkdir. Written with Claude Code.

Author

botBehavior · botbehavior.dev

Licence

Apache-2.0.

About

Deploy a built static site to Cloudflare Workers static assets, from Rust. No wrangler, no Node.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages