forked from 77media/video-flow
处理代码
This commit is contained in:
parent
b642b136fb
commit
7d49e8823b
28
compile.sh
28
compile.sh
@ -1,5 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
BRANCH_NAME="dev"
|
||||
|
||||
# 修改项目名称
|
||||
PROJECT_NAME="video-flow-frontend"
|
||||
|
||||
@ -12,9 +14,9 @@ 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 分支"
|
||||
# 打包之前,需要检查是否在 pre 分支,工作区是否干净,是否和远程分支一致
|
||||
if [ "$(git branch --show-current)" != "$BRANCH_NAME" ]; then
|
||||
echo "当前分支不是 pre 分支"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -24,27 +26,17 @@ 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/$BRANCH_NAME)" ]; then
|
||||
echo "本地分支和远程分支不一致"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# 检查当前分支并运行相应的 npm 命令
|
||||
if [ "$current_branch" = "dev" ]; then
|
||||
if [ "$current_branch" = "$BRANCH_NAME" ]; then
|
||||
echo "On dev branch, building project..." | tee -a $LOGFILE
|
||||
PROFILE_ENV=dev
|
||||
PROFILE_ENV=$BRANCH_NAME
|
||||
|
||||
# 安装依赖并构建
|
||||
yarn install
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user