publish.sh
1.3 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
DIR="$( cd "$( dirname "$0" )" && pwd )"
if [ $# -lt 1 ]; then
echo "云订单 发布脚本"
echo "Usage: $0 <test|prod>"
echo ""
echo " - $0 test # 发布到测试环境"
echo " - $0 prod # 发布到生产环境"
echo ""
exit 1
fi
test_path=/www/wwwroot/www.order-php-test.com
prod_path=/www/wwwroot/www.order-php.com
function publish_to () {
what_path=$1
\cp ./composer.json $what_path/ -f
chown www:www $what_path/composer.json
\cp ./common/* $what_path/common/ -Rrf
chown www:www $what_path/common/* -R
\cp ./config/* $what_path/config/ -Rrf
chown www:www $what_path/config/* -R
\cp ./controllers/* $what_path/controllers/ -Rrf
chown www:www $what_path/controllers/* -R
\cp ./logic/* $what_path/logic/ -Rrf
chown www:www $what_path/logic/* -R
\cp ./dao/* $what_path/dao/ -Rrf
chown www:www $what_path/dao/* -R
\cp ./models/* $what_path/models/ -Rrf
chown www:www $what_path/models/* -R
\cp ./jobs/* $what_path/jobs/ -Rrf
chown www:www $what_path/jobs/* -R
}
cd /www/wwwroot/git/order-php
git pull
echo "发布到测试环境……"
publish_to $test_path
if [[ "$1" == "prod" ]]
then
echo "发布到生产环境..."
publish_to $prod_path
fi
echo "云订单域 发布完成!"