#!/bin/bash # # 部署脚本 # set -e # APP_NAME=flashdeliver START_TIME=$(date +%s) DATE=$(date +%m/%d/%y) TIME=$(date +%k:%M:%S) TARGET_VERSION=$(date +%Y%m%d%H%M) # 目录配置 DIST_NAME="dist" BUILD_NAME=build WORK_DIR=/d/work-space/vue-wechat-addons-flashdeliver REMOTE_DIR=/data/flashdeliver # SSH配置 REMOTE_USER=root REMOTE_IP=175.178.185.146 PRIVATE_SSH_KEY=/d/work-space/ssh-key/id_rsa_my_tencent_146 # workspace cd $WORK_DIR # build echo -e "\033[34m[INFO]\033[0m Building $APP_NAME ..." npm run $BUILD_NAME # upload echo -e "\033[34m[INFO]\033[0m Uploading $APP_NAME to $REMOTE_IP ..." tar -cf "$DIST_NAME.zip" $DIST_NAME scp -i $PRIVATE_SSH_KEY "$DIST_NAME.zip" "$REMOTE_USER@$REMOTE_IP:$REMOTE_DIR" rm "$DIST_NAME.zip" # publish echo -e "\033[34m[INFO]\033[0m Publishing $APP_NAME to $REMOTE_IP ..." ssh -i $PRIVATE_SSH_KEY "$REMOTE_USER@$REMOTE_IP" /bin/bash <