forked from mlaursen/react-md
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
executable file
·35 lines (28 loc) · 1.09 KB
/
deploy.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
#!/bin/bash
# exit on any error
set -e
tar_name=react-md.tar.bz2
ssh_alias=react-md
server_location=/var/www/react-md/master
yarn && yarn prebuild && yarn scripts && yarn build:es
cd docs
yarn && yarn build
cd ..
rm -f "$tar_name"
tar --exclude='docs/src/server/databases/.gitkeep' \
--exclude='docs/src/server/databases/airQuality.json' \
--exclude='docs/public/.DS_STORE' \
--exclude='docs/public/robots.txt' \
--exclude='docs/public/favicon.ico' \
--exclude='docs/public/react-md.png' \
-jcvf "$tar_name" \
lib \
docs/dist \
docs/public \
docs/src/constants/scssColors.js \
docs/src/server/databases \
docs/webpack-assets.json
rm_assets="rm -rf public/sassdoc dist && find public ! -name 'robots.txt' ! -name 'react-md.png' ! -name 'favicon.ico' ! -path '**/themes/**' -type f -exec rm -f {} +"
ssh "$ssh_alias" "cd $server_location && git pull && yarn && rm -rf lib && cd docs && $rm_assets && yarn --production"
scp "$tar_name" "$ssh_alias":"$server_location"
ssh "$ssh_alias" "cd $server_location && tar jxvf $tar_name && git clean -f && cd .. && pm2 start processes.yml"