Forest_Client/Tool/BuildTool/upload_apk.sh

35 lines
707 B
Bash

SHELL_DIR=$(dirname $0)
echo "change dir to $SHELL_DIR"
cd "$SHELL_DIR"
# 获取项目相关参数
if [ -f ./project_env.sh ]; then
source ./project_env.sh
echo "found the project_env file"
fi
VERSION="$1"
PLATFORM="$2"
WORKSPACE="$3"
APK_NAME="$BUILD_NAME.apk"
REMOTE_PATH="/$REMOTE_UPLOAD_PATH/$WORKSPACE/$PLATFORM/$VERSION/"
echo "upload folder is: ${REMOTE_PATH}"
ssh "$REMOTE_USER@$REMOTE_HOST" "mkdir -p $REMOTE_PATH"
cd "../../Builds/$PLATFORM/$VERSION/"
scp "${APK_NAME}" "$REMOTE_USER@$REMOTE_HOST:$REMOTE_PATH"
upload_result=$?
if [ $upload_result -eq 0 ]; then
echo "apk uploaded to remote server successfully."
else
echo "Failed to upload apk to remote server."
fi