Files
baron_qa_write/scripts/upload-r2.sh
T
root 9bbd9ed8ce
Deploy EG-BIM QA Gateway / deploy (push) Successful in 40s
디렉토리 구조 개선(egbim 분리)
2026-09-21 16:48:42 +09:00

34 lines
1.0 KiB
Bash
Executable File

#!/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"