新增氛围灯功能,对 EQ 名称长度做限制

This commit is contained in:
eafonyang
2026-06-30 15:28:53 +08:00
parent 98e8738e79
commit 8283ffcf14
18 changed files with 407 additions and 66 deletions
+66 -20
View File
@@ -1,20 +1,33 @@
#!/bin/bash
# ============================================================
# 部署脚本 - 支持 test 环境与 images 目录排除
#
# 用法:
# ./scripts/deploy.sh 上传至正式环境 (v2)
# ./scripts/deploy.sh -test 上传至测试环境 (test)
# ./scripts/deploy.sh -eximg 排除 images 目录,上传至正式环境
# ./scripts/deploy.sh -eximg -test 排除 images 目录,上传至测试环境
# -reload 参数:上传完成后刷新 CloudFront 缓存
# ./scripts/deploy.sh -reload 上传正式环境并刷新缓存
# ./scripts/deploy.sh -eximg -test -reload 排除 images,上传测试环境并刷新缓存
# 部署脚本 - 支持 test/prod 环境与 images 目录排除
# ============================================================
set -e
show_help() {
cat <<EOF
用法: ./scripts/deploy.sh [环境] [选项]
环境(可选,默认 prod:
prod 上传至正式环境 (s3://.../v2/)
test 上传至测试环境 (s3://.../test/)
选项(可合并,如 -ir:
-i 排除 images 目录 (*images/*)
-r 上传完成后刷新 CloudFront 缓存
-h 显示此帮助
示例:
./scripts/deploy.sh # prod,不排除 images,不刷新
./scripts/deploy.sh test # test 环境
./scripts/deploy.sh test -ir # test,排除 images,并刷新缓存
./scripts/deploy.sh prod -i # prod,排除 images
./scripts/deploy.sh -r # prod,刷新缓存
EOF
}
# 自动识别项目名称 (x8 / x9),依据脚本所在的项目根目录名
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(basename "$(dirname "$SCRIPT_DIR")")"
@@ -26,24 +39,49 @@ if [ -z "$PROJECT_NAME" ]; then
fi
# 解析参数
TARGET_ENV="prod" # 默认正式环境
EXCLUDE_IMAGES=false # 默认不排除 images
RELOAD=false # 默认不刷新 CloudFront 缓存
TARGET_ENV="prod"
EXCLUDE_IMAGES=false
RELOAD=false
for arg in "$@"; do
case "$arg" in
-test)
TARGET_ENV="test"
-h|--help)
show_help
exit 0
;;
-eximg)
EXCLUDE_IMAGES=true
test|prod)
TARGET_ENV="$arg"
;;
-reload)
RELOAD=true
-*)
flags="${arg#-}"
if [ -z "$flags" ]; then
echo "未知参数: $arg"
echo ""
show_help
exit 1
fi
for ((i = 0; i < ${#flags}; i++)); do
c="${flags:i:1}"
case "$c" in
i)
EXCLUDE_IMAGES=true
;;
r)
RELOAD=true
;;
*)
echo "未知选项: -$c"
echo ""
show_help
exit 1
;;
esac
done
;;
*)
echo "未知参数: $arg"
echo "用法: ./scripts/deploy.sh [-test] [-eximg] [-reload]"
echo ""
show_help
exit 1
;;
esac
@@ -79,6 +117,14 @@ echo "命令: ${CMD_ARGS[*]}"
echo "=========================================="
echo ""
read -r -p "确认执行部署? 输入 y 继续: " confirm
if [[ ! "$confirm" =~ ^[Yy]$ ]]; then
echo "已取消部署。"
exit 0
fi
echo ""
# 执行同步
"${CMD_ARGS[@]}"