打包脚本

This commit is contained in:
北枳 2025-09-15 16:18:24 +08:00
parent 18e517f8fd
commit e164b1ab76
2 changed files with 6 additions and 6 deletions

12
compile_test.sh → compile_prod.sh Executable file → Normal file
View File

@ -1,9 +1,9 @@
#!/bin/bash
BRANCH_NAME="dev"
BRANCH_NAME="prod"
# 修改项目名称
PROJECT_NAME="video-flow-frontend-test"
PROJECT_NAME="video-flow-$BRANCH_NAME-frontend"
# 设置日志文件路径
LOGFILE="build_and_copy.log"
@ -14,9 +14,9 @@ echo "Build process started at $(date)" | tee $LOGFILE
# 获取当前分支名
current_branch=$(git rev-parse --abbrev-ref HEAD)
# 打包之前,需要检查是否在 dev 分支,工作区是否干净,是否和远程分支一致
# 打包之前,需要检查是否在 prod 分支,工作区是否干净,是否和远程分支一致
if [ "$(git branch --show-current)" != "$BRANCH_NAME" ]; then
echo "当前分支不是 dev 分支"
echo "当前分支不是 prod 分支"
exit 1
fi
@ -35,7 +35,7 @@ fi
# 检查当前分支并运行相应的 npm 命令
if [ "$current_branch" = "$BRANCH_NAME" ]; then
echo "On dev branch, building project..." | tee -a $LOGFILE
echo "On prod branch, building project..." | tee -a $LOGFILE
PROFILE_ENV=$BRANCH_NAME
# 安装依赖并构建
@ -50,7 +50,7 @@ if [ "$current_branch" = "$BRANCH_NAME" ]; then
cp package-lock.json dist/
else
echo "On non-dev branch ($current_branch), exiting"
echo "On non-prod branch ($current_branch), exiting"
exit 1
fi