publish.sh
845 Bytes
#!/usr/bin/env sh
# -----------------------------------------------
# Filename: publish.sh
# Revision: 1.0
# Date: 2022年8月05日
# Author: Hooke
# Description: **** 根据php项目相应特征书写项目发布流程
# -----------------------------------------------
# 当发生错误时中止脚本
set -e
# 本地Git服务器目录路径
path=/Users/huyirui/program/itomix/git/isp/f/guanzong
# 编译输出文件夹
output=web
# 打包
npm run build
# 移除Git服务器目录下项目文件夹
rm -r $path"/${output:?}"
# 把本地编译输出文件夹添加到服务器目录
mv "${output:?}/" $path
# 提交到Git服务器
cd $path"/${output:?}"
git pull
git add -A
git commit -m '前端网页更新'
git push
# 更新SSH服务器上文件
ssh -p 22 itomix@ipadbiz.cn 'cd /opt/voice/f/guanzong/web && git pull'