Files
baron_qa_write/scripts/upload-r2.sh
T
root c62630e22d feat(ui): apply inquiry list and modal design
Apply the supplied inquiry layout to the list and native write/detail dialogs while preserving existing API requests, author controls, attachments, comments and search. Keep legacy entry links and confirm before discarding drafts.

Validation: 98 tests and syntax checks pass; mocked Chromium desktop/mobile and six author/session visibility scenarios pass.
2026-11-02 13:11:47 +09:00

44 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
bucket="${1:-baron-qa-pages}"
config="${2:-wrangler.toml}"
prefix="${3:-}"
if [ "$bucket" = "baron-qa-write" ]; then
if [ "$config" != "wrangler.production.toml" ] || [[ ! "$prefix" =~ ^releases/[0-9a-f]{40}$ ]]; then
echo "Production uploads require the production config and a full commit release prefix" >&2
exit 1
fi
fi
upload() {
local file="$1"
local key="${prefix:+$prefix/}$2"
local content_type="$3"
npx --no-install wrangler r2 object put "$bucket/$key" --config "$config" --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" ;;
*.webp) content_type="image/webp" ;;
*.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"