publish.sh
1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env sh
# -----------------------------------------------
# Filename: publish.sh
# Revision: 1.0
# Date: 2022年5月20日
# Author: Hooke
# Description: **** 根据php项目相应特征书写项目发布流程
# -----------------------------------------------
# 当发生错误时中止脚本
set -e
# 本地Git服务器目录路径
path=/Users/huyirui/program/itomix/git/isp/f
# 编译输出文件夹
output=reserve
# 打包
npm run build
# 移除Git服务器目录下项目文件夹
rm -r $path"/${output:?}/images"
rm -r $path"/${output:?}/index.html"
rm -r $path"/${output:?}/static"
# 把本地编译输出文件夹添加到服务器目录
mv "${output:?}/images" $path"/${output:?}"
mv "${output:?}/index.html" $path"/${output:?}"
mv "${output:?}/static" $path"/${output:?}"
# 提交到Git服务器
cd $path"/${output:?}"
git pull
git add -A
git commit -m '西园寺预约前端网页更新'
git push
# 更新SSH服务器上文件
ssh -p 22 itomix@ipadbiz.cn 'cd /opt/space-dev/ && git pull origin develop'