#!/bin/sh
GIT_HOME=/developer/git-repository/
DEST_PATH=/product/frontend/
if [ ! -n "$1" ];
then
echo -e "请输入要发布的项目"
exit
fi
if [ $1 = "CampusO2OUserView" ];
then
echo -e "---------Enter CampusO2OUserView view Project--------"
cd $GIT_HOME$1
elif [ $1 = "ampusO2O" ];
then
echo -e "---------Enter ampusO2O view Project--------"
cd $GIT_HOME$1
else
echo -e "Invalid Project Name!"
exit
fi
# clean dist
echo -e "---------Clean Dist--------"
rm -rf ./dist
#git操作
echo -e "---------Git checkout master--------"
git checkout master
echo -e "---------Git Pull--------"
git pull
echo -e "---------npm Install--------"
npm install --registry=https://registry.npm.taobao.org
echo -e "---------npm Run Dist--------"
npm run dist
if [ -d "./dist" ];
then
echo -e "---------clean Dest--------"
rm -rf $DEST_PATH/dist
echo -e "---------copy Dest--------"
cp -R ./dist $DEST_PATH/$1/
echo -e "---------Deploy Success--------"
else
echo -e "---------Deploy Fail--------"
fi
Shel脚本demo
最新推荐文章于 2023-01-02 12:30:12 发布