forked from 77media/video-flow
更新 compile.sh
This commit is contained in:
parent
7603a1a26e
commit
076d24143c
39
compile.sh
39
compile.sh
@ -1,17 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/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 分支,工作区是否干净,是否和远程分支一致
|
# 打包之前,需要检查是否在 dev 分支,工作区是否干净,是否和远程分支一致
|
||||||
if [ "$(git branch --show-current)" != "dev" ]; then
|
if [ "$(git branch --show-current)" != "dev" ]; then
|
||||||
echo "当前分支不是 dev 分支"
|
echo "当前分支不是 dev 分支"
|
||||||
@ -24,23 +12,24 @@ 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/dev)" ]; 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
|
||||||
|
|
||||||
|
# 修改项目名称
|
||||||
|
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 命令
|
# 检查当前分支并运行相应的 npm 命令
|
||||||
if [ "$current_branch" = "dev" ]; then
|
if [ "$current_branch" = "dev" ]; then
|
||||||
echo "On dev branch, building project..." | tee -a $LOGFILE
|
echo "On dev branch, building project..." | tee -a $LOGFILE
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user