#!/usr/bin/env bash set -euo pipefail bucket="${1:-baron-qa-pages}" upload() { local file="$1" local key="$2" local content_type="$3" npx wrangler r2 object put "$bucket/$key" --file "$file" --content-type "$content_type" --remote } upload egbim/index.html egbim/index.html text/html upload egbim/write.html egbim/write.html text/html upload egbim/detail.html egbim/detail.html text/html upload egbim/app.js egbim/app.js application/javascript upload egbim/config.js egbim/config.js application/javascript while IFS= read -r file; do key="${file#./}" case "$file" in *.css) content_type="text/css" ;; *.js) content_type="application/javascript" ;; *.woff2) content_type="font/woff2" ;; *.svg) content_type="image/svg+xml" ;; *.png) content_type="image/png" ;; *.jpg|*.jpeg) content_type="image/jpeg" ;; *) content_type="application/octet-stream" ;; esac upload "$file" "$key" "$content_type" done < <(find ./assets -type f -not -name '*.map' -print | sort) echo "Uploaded static files to R2 bucket: $bucket"