修改compile

This commit is contained in:
Xin Wang 2025-07-04 17:55:11 +08:00
parent b642b136fb
commit ef7ba4aff4

View File

@ -1,20 +1,22 @@
#!/bin/bash #!/bin/bash
# 修改项目名称 # 修改项目名称
PROJECT_NAME="video-flow-frontend" PROJECT_NAME="video-flow-pre-frontend"
# 设置日志文件路径 # 设置日志文件路径
LOGFILE="build_and_copy.log" LOGFILE="build_and_copy.log"
BRANCH_NAME="pre"
# 记录开始时间 # 记录开始时间
echo "Build process started at $(date)" | tee $LOGFILE echo "Build process started at $(date)" | tee $LOGFILE
# 获取当前分支名 # 获取当前分支名
current_branch=$(git rev-parse --abbrev-ref HEAD) current_branch=$(git rev-parse --abbrev-ref HEAD)
# 打包之前,需要检查是否在 dev 分支,工作区是否干净,是否和远程分支一致 # 打包之前,需要检查是否在 pre 分支,工作区是否干净,是否和远程分支一致
if [ "$(git branch --show-current)" != "dev" ]; then if [ "$(git branch --show-current)" != "$BRANCH_NAME" ]; then
echo "当前分支不是 dev 分支" echo "当前分支不是 pre 分支"
exit 1 exit 1
fi fi
@ -24,27 +26,17 @@ if [ -n "$(git status --porcelain)" ]; then
exit 1 exit 1
fi fi
# 获取最新的远程分支信息
echo "正在获取最新的远程分支信息..." | tee -a $LOGFILE
git fetch movie-flow
# 检查远程分支是否和本地分支一致 # 检查远程分支是否和本地分支一致
local_commit=$(git rev-parse HEAD) if [ "$(git rev-parse HEAD)" != "$(git rev-parse origin/$BRANCH_NAME)" ]; then
remote_commit=$(git rev-parse movie-flow/dev) echo "本地分支和远程分支不一致"
if [ "$local_commit" != "$remote_commit" ]; then
echo "本地分支和远程分支不一致" | tee -a $LOGFILE
echo "本地分支: $local_commit" | tee -a $LOGFILE
echo "远程分支: $remote_commit" | tee -a $LOGFILE
echo "请运行以下命令之一来解决:" | tee -a $LOGFILE
echo " git pull movie-flow dev # 如果远程有新提交" | tee -a $LOGFILE
echo " git push movie-flow dev # 如果本地有新提交" | tee -a $LOGFILE
exit 1 exit 1
fi fi
# 检查当前分支并运行相应的 npm 命令 # 检查当前分支并运行相应的 npm 命令
if [ "$current_branch" = "dev" ]; then if [ "$current_branch" = "$BRANCH_NAME" ]; then
echo "On dev branch, building project..." | tee -a $LOGFILE echo "On dev branch, building project..." | tee -a $LOGFILE
PROFILE_ENV=dev PROFILE_ENV=$BRANCH_NAME
# 安装依赖并构建 # 安装依赖并构建
yarn install yarn install