更新 compile.sh

This commit is contained in:
wangxin 2025-07-04 17:13:00 +08:00
parent 7603a1a26e
commit 076d24143c

View File

@ -1,17 +1,5 @@
#!/bin/bash
# 修改项目名称
PROJECT_NAME="video-flow-frontend"
# 设置日志文件路径
LOGFILE="build_and_copy.log"
# 记录开始时间
echo "Build process started at $(date)" | tee $LOGFILE
# 获取当前分支名
current_branch=$(git rev-parse --abbrev-ref HEAD)
# 打包之前,需要检查是否在 dev 分支,工作区是否干净,是否和远程分支一致
if [ "$(git branch --show-current)" != "dev" ]; then
echo "当前分支不是 dev 分支"
@ -24,23 +12,24 @@ if [ -n "$(git status --porcelain)" ]; then
exit 1
fi
# 获取最新的远程分支信息
echo "正在获取最新的远程分支信息..." | tee -a $LOGFILE
git fetch movie-flow
# 检查远程分支是否和本地分支一致
local_commit=$(git rev-parse HEAD)
remote_commit=$(git rev-parse movie-flow/dev)
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
if [ "$(git rev-parse HEAD)" != "$(git rev-parse origin/dev)" ]; then
echo "本地分支和远程分支不一致"
exit 1
fi
# 修改项目名称
PROJECT_NAME="video-flow-frontend"
# 设置日志文件路径
LOGFILE="build_and_copy.log"
# 记录开始时间
echo "Build process started at $(date)" | tee $LOGFILE
# 获取当前分支名
current_branch=$(git rev-parse --abbrev-ref HEAD)
# 检查当前分支并运行相应的 npm 命令
if [ "$current_branch" = "dev" ]; then
echo "On dev branch, building project..." | tee -a $LOGFILE