The Publish Script
publish.sh is a self-contained bash script that handles the entire publish flow: scanning files, computing hashes, uploading, and finalizing.
Download
Requirements
curl— for HTTP requestsjq— for JSON parsingshasumorsha256sum— for file hashing (pre-installed on macOS and most Linux)
Usage
Publish a new site
Update an existing site
With authentication (permanent sites)
Custom API base URL
What the Script Does
Scan files
Recursively finds all files in the directory and builds a JSON manifest with relative paths, sizes, content types, and SHA-256 hashes.
Create or update
Sends the manifest to
POST /api/v1/publish (new site) or PUT /api/v1/publish/:slug (update).Upload files
Uploads each file to its presigned URL. Files that match by hash are skipped automatically.
Output
Supported File Types
The script automatically detects content types for common file extensions:| Category | Extensions |
|---|---|
| Web | .html, .css, .js, .json, .xml, .svg |
| Images | .png, .jpg, .jpeg, .gif, .webp, .avif, .ico |
| Fonts | .woff, .woff2, .ttf, .otf |
| Media | .mp4, .webm, .mp3, .ogg, .wav |
| Documents | .pdf, .txt, .md, .csv |
| Other | .zip and any unrecognized extension (application/octet-stream) |