Skip to main content

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

curl -fsSL https://supalink.dev/publish.sh -o publish.sh && chmod +x publish.sh

Requirements

  • curl — for HTTP requests
  • jq — for JSON parsing
  • shasum or sha256sum — for file hashing (pre-installed on macOS and most Linux)

Usage

Publish a new site

./publish.sh ./my-directory

Update an existing site

./publish.sh ./my-directory existing-slug

With authentication (permanent sites)

export SUPALINK_API_KEY="sl_live_your_key_here"
./publish.sh ./dist

Custom API base URL

export SUPALINK_BASE="https://supalink.dev"
./publish.sh ./dist

What the Script Does

1

Scan files

Recursively finds all files in the directory and builds a JSON manifest with relative paths, sizes, content types, and SHA-256 hashes.
2

Create or update

Sends the manifest to POST /api/v1/publish (new site) or PUT /api/v1/publish/:slug (update).
3

Upload files

Uploads each file to its presigned URL. Files that match by hash are skipped automatically.
4

Finalize

Calls the finalize endpoint to make the site live.

Output

📦 Scanning files...
  Found 12 file(s)
🚀 Creating site...
  Site: bright-canvas-a7k2
  Skipped (dedup): 0 file(s)
⬆️  Uploading 12 file(s)...
  [1/12] index.html
  [2/12] style.css
  ...
✅ Finalizing...

🎉 Published!
   URL:  https://bright-canvas-a7k2.supalink.dev/
   Slug: bright-canvas-a7k2

Supported File Types

The script automatically detects content types for common file extensions:
CategoryExtensions
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)

CI/CD Integration

You can use the script in any CI/CD pipeline:
# GitHub Actions example
- name: Publish to Supalink
  env:
    SUPALINK_API_KEY: ${{ secrets.SUPALINK_API_KEY }}
  run: |
    curl -fsSL https://supalink.dev/publish.sh -o publish.sh && chmod +x publish.sh
    ./publish.sh ./dist