-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdeploy.sh
executable file
·48 lines (32 loc) · 1.55 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
36
37
38
39
40
41
42
43
44
45
46
47
# Deploy
TEST_SERVER="test.jxndao.com"
TEST_UPLOAD="~/storefront-test/"
PROD_UPLOAD="~/storefront-prod/"
# check axios.ts to enable the right API endpoint
DEPLOY_TARGET=$TEST_UPLOAD
FLAVOR_PATH="src/config"
FLAVOR_CONFIG_FILE="flavorconfig.tsx"
FLAVOR_CONFIG_TEST="flavorconfig.test"
FLAVOR_CONFIG_PROD="flavorconfig.prod"
FLAVOR_CONFIG_TEMP="flavorconfig.temp"
deployTarget=$1
URL=$TEST_SERVER
echo "backing up flavor config ${FLAVOR_PATH}/${FLAVOR_CONFIG_FILE} to ${FLAVOR_PATH}/${FLAVOR_CONFIG_TEMP}"
mv "${FLAVOR_PATH}/${FLAVOR_CONFIG_FILE}" "${FLAVOR_PATH}/${FLAVOR_CONFIG_TEMP}"
if [ "$deployTarget" == "prod" ]
then
DEPLOY_TARGET=$PROD_UPLOAD
echo "*************** WARNING: deploying to prod environment ubuntu@${URL}:${DEPLOY_TARGET}************************************"
cp "${FLAVOR_PATH}/${FLAVOR_CONFIG_PROD}" "${FLAVOR_PATH}/${FLAVOR_CONFIG_FILE}"
echo "*************** copying flavor config prod: ${FLAVOR_PATH}/${FLAVOR_CONFIG_PROD} to ${FLAVOR_PATH}/${FLAVOR_CONFIG_FILE} ****************************"
else
cp "${FLAVOR_PATH}/${FLAVOR_CONFIG_TEST}" "${FLAVOR_PATH}/${FLAVOR_CONFIG_FILE}"
echo "*************** copying flavor config test: ${FLAVOR_PATH}/${FLAVOR_CONFIG_TEST} to ${FLAVOR_PATH}/${FLAVOR_CONFIG_FILE} ****************************"
fi
rm -rf build
yarn build
# Sync version
echo "syncing build to ubuntu@${URL}:${DEPLOY_TARGET}"
rsync -av --progress --stats --human-readable build "ubuntu@${URL}:${DEPLOY_TARGET}"
echo "restoring up flavor config"
cp "${FLAVOR_PATH}/${FLAVOR_CONFIG_TEMP}" "${FLAVOR_PATH}/${FLAVOR_CONFIG_FILE}"