forked from firekylin/firekylin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
98 lines (77 loc) · 2.37 KB
/
build.sh
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/sh
if [ -d "/Users/lizheming/Desktop/workspace/stc" ]; then
STC_PATH="/Users/lizheming/Desktop/workspace/stc"
elif [ -d "/Users/akira_cn/Workspace/thinkjs/firekylin/stc/src" ]; then
STC_PATH="/Users/akira_cn/Workspace/thinkjs/firekylin/stc/src"
else
STC_PATH="/Users/welefen/Develop/git/stc/src"
fi
path=`dirname $0`;
first=${path:0:1};
if [[ $first != '/' ]];then
path=$(pwd);
fi
rm -rf firekylin;
if [ -d ${path}"/output" ];then
rm -rf ${path}"/output";
fi
if [ -d ${path}"/output.theme" ];then
rm -rf ${path}"/output.theme";
fi
mkdir ${path}"/output";
if [ ! -f ${path}"/config.php" ];then
cp $STC_PATH/config/config.php ${path};
fi
if [ -f /usr/local/bin/php ];then
PHP="/usr/local/bin/php";
else
PHP="/usr/bin/php";
fi
echo 'webpack start ...';
webpack;
echo 'webpack end';
rm -rf www/static/js/admin.bundle.js.map;
rm -rf www/static/js/common.js.map;
$PHP $STC_PATH/index.php ${path} test online;
mkdir -p www/theme/firekylin.build/html;
cp -r www/theme/firekylin/*.html www/theme/firekylin.build/html/
cp -r www/theme/firekylin/inc www/theme/firekylin.build/html/
cp -r www/theme/firekylin/package.json www/theme/firekylin.build/html/
$PHP $STC_PATH/index.php ${path} test online config_theme.php output.theme;
cp -r output.theme/www/theme/firekylin.build/html/* output.theme/www/theme/firekylin;
rm -rf output.theme/www/theme/firekylin.build;
cp -r output.theme/www/ output/www/
rm -rf output.theme;
rm -rf www/theme/firekylin.build/;
if [ -f ${path}"/stc.error.log" ]; then
rm -rf ${path}"/stc.error.log";
#exit 1;
fi
npm run compile;
npm run copy-package;
cp -r app output;
cp -r nginx.conf output/nginx_default.conf;
cp -r pm2.json output/pm2_default.json;
cp -r www/*.js output/www;
cp -r db/firekylin.sql output/;
if [ 0 -eq `grep -c analyze_code output/firekylin.sql` ];then
echo 'missing analyze_code in firekylin.sql';
exit;
fi
cp -r auto_build.sh output/;
cp -r https.js output/;
cp -r https.sh output/;
rm -r output/app/common/config/db.js;
mv output firekylin;
VERSION=`cat .version`;
TARNAME=firekylin_${VERSION}.tar.gz;
tar zcf $TARNAME firekylin/;
mv $TARNAME build;
rm -rf firekylin/;
cd build;
tar zxvfm $TARNAME;
HOST="qiw""oo@firekylin.org";
REMOTE_TAR="/home/qiw""oo/www/firekylin.org/www/release";
scp $TARNAME $HOST:$REMOTE_TAR;
ssh $HOST cp $REMOTE_TAR/$TARNAME $REMOTE_TAR/latest.tar.gz;
ssh $HOST "echo $VERSION > $REMOTE_TAR/.latest";