Forest_Client/Tool/BuildTool/upload_apk.sh

35 lines
707 B
Bash
Raw Normal View History

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