【打包】上传脚本

main
Zhangaotian 2023-10-26 17:28:10 +08:00
parent 5047e50f66
commit 5ea3602e5e
1 changed files with 9 additions and 12 deletions

View File

@ -1,5 +1,13 @@
##!/bin/bash
SHELL_DIR=$(dirname $0)
echo "change dir to $SHELL_DIR"
cd "$SHELL_DIR"
# Source the local environment
if [ -f ./local_env.sh ]; then
source ./local_env.sh
echo "found the local_env file"
fi
VERSION="$1"
PLATFORM="$2"
@ -10,23 +18,12 @@ REMOTE_HOST="132.232.113.98"
REMOTE_PATH="/var/www/html/nld/WorkSpace/$PLATFORM/$VERSION"
# Set remote Build Path (local) (modify as needed)
BUILD_PATH="$PROJECT_PATH/ServerData/$PLATFORM/"
BUILD_PATH="$PROJECT_Android_PATH/ServerData/$PLATFORM/"
# Set the URL where you want to send the message
NOTE_URL="https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=3c92758c-1128-4931-ac8d-f19669d7befe"
echo "change dir to $SHELL_DIR"
cd "$SHELL_DIR"
# Source the local environment
if [ -f ./local_env.sh ]; then
source ./local_env.sh
echo "found the local_env file"
fi
tar -czvf upload.tgz -C "$BUILD_PATH" .
ssh "$REMOTE_USER@$REMOTE_HOST" "mkdir -p $REMOTE_PATH"
scp upload.tgz "$REMOTE_USER@$REMOTE_HOST:$REMOTE_PATH"