##!/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 # 获取项目相关参数 if [ -f ./project_env.sh ]; then source ./project_env.sh echo "found the project_env file" fi VERSION="$1" PLATFORM="$2" PROFILE="$3" CHANNEL="$4" ENABLE_HOT_UPDATE="$5" ARTIFACT_URL="$6" # Set if needs to clear cache CLEARCACHED="yes" #CLEARCACHED="no" BUILD_FOLDER="../../Builds/$PLATFORM/$VERSION" #相对脚本路径 EXECUTE_METHOD="BatchBuild.UpdatePreviousBuild" LOG_FILE="$BUILD_FOLDER/UpdatePreviousBuild.log" #相对脚本路径 echo "Start update previous building ... ..." "$UNITY_PATH" -quit -batchmode -projectPath "../../$PROJECT_NAME" -executeMethod "$EXECUTE_METHOD" \ -platform "$PLATFORM" \ -profile "$PROFILE" \ -appVersion "$VERSION" \ -clearCached "$CLEARCACHED" \ -channel "$CHANNEL" \ -enableHotUpdate "$ENABLE_HOT_UPDATE" \ -logFile "$LOG_FILE" build_result=$? if [ $build_result -ne 0 ]; then echo "Update build failed. Check the log for details." sh to_inner_wechat_robot.sh "【$PLATFORM】【$VERSION】【$PROFILE】Failed to Update a previous build Addressable, Check the log for details:$ARTIFACT_URL" sh collect_and_send_error.sh $LOG_FILE exit 1 else echo " Update a previous build successful! !" fi