publish_prod.sh 1.5 KB
#!/usr/bin/env sh
# -----------------------------------------------
# Filename:    publish.sh
# Revision:    1.0
# Date:        2022年5月20日
# Author:      Hooke
# Description: **** 根据php项目相应特征书写项目发布流程
# -----------------------------------------------

# 当发生错误时中止脚本
set -e

# 记录当前开发的绝对路径
CURR_PATH=$(pwd)

# 本地Git服务器目录路径
PHP_PATH=/Users/huyirui/program/itomix/git/isp/f/custom_form

# 编译输出文件夹
output=sku_request

# 打包
rm -rf sku_request
npm run build

# 删除 PHP 项目里的编译产物
cd $PHP_PATH
git checkout custom_form
rm -rf $PHP_PATH"/${output:?}"
# 把编译产物复制到 PHP 项目
cd $CURR_PATH
cp -r "${output:?}/" $PHP_PATH"/${output:?}"

# PHP 项目的编译产物提交到 Git 服务器
cd $PHP_PATH
git pull
git add -A
git commit -m '自定义表单-前端网页更新'
git push

# 更新其他分支数据
# git checkout master
# git pull origin master
# git merge --no-edit custom_form
# git push origin master

# git checkout guanzong
# git pull origin guanzong
# git merge --no-edit custom_form
# git push origin guanzong

git checkout mituo
git pull origin mituo
git merge --no-edit custom_form
git push origin mituo

# ssh -p 22 itomix@ipadbiz.cn '
#   cd /opt/oa;
#   git pull origin master;
#   cd /opt/guanzong;
#   git pull origin guanzong;
#   cd /opt/mituo;
#   git pull origin mituo;
# '
ssh -p 22 itomix@ipadbiz.cn '
  cd /opt/mituo;
  git pull origin mituo;
'

git checkout custom_form;