You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

159 lines
5.5 KiB

1 month ago
#!/bin/bash
set -x
for i in "$@"; do
if [[ $i = *"="* ]]; then
eval "$i"
fi
done
cur_dir=$(cd $(dirname $0); pwd)
share_dir=$cur_dir/..
root_dir=/Volumes/PackageDisk/www/arpg
if [[ $uploadDir != "" ]]; then
root_dir=$uploadDir
fi
www_dir=$root_dir
unity_app="/Applications/Unity/Unity.app/Contents/MacOS/Unity"
build_graph="Assets/ZXToolkit/AssetGraph/Graph/BuildGraph.asset"
arpg_cli_dir=$share_dir/../pandora_cli_proj
arpg_pro_dir=$arpg_cli_dir/pandora
if [ $publishChannel == "" ]; then
publishChannel="google_oversea"
fi
if [ $isUsingNewAB == "true" ]; then
build_graph="Assets/ZXToolkit/AssetGraph/Graph/BuildGraph_new.asset"
fi
buid_name=arpg_${publishChannel}_${version}_`date "+%Y%m%d_%H%M%S"`
if [ $development == "true" ]; then
buid_name=${buid_name}_development
fi
output_dir=$share_dir/../build/android
log_dir=$output_dir/../log/android
build_file_name=${buid_name}.apk
if [ $mode == "aab" ]; then
build_file_name=${buid_name}.aab
www_dir=${www_dir}/android
elif [ $mode == "apk" ]; then
www_dir=${www_dir}/android
elif [ $mode == "ios" ]; then
www_dir=${www_dir}/ios
output_dir=$share_dir/../build/ios
log_dir=$output_dir/../log/ios
fi
outpath=$output_dir/${build_file_name}
if [ ! -d ${output_dir} ]; then
mkdir ${output_dir}
fi
if [ ! -d ${log_dir} ]; then
mkdir ${log_dir}
fi
#python $arpg_cli_dir/tools/jenkins_script/generate_local_update_zip.py "false"
cd $arpg_cli_dir
# svn cleanup --remove-unversioned
# svn revert --depth=infinity .
# svn update
python $arpg_cli_dir/../arpg_share_proj/MacBuild/build_generate_common.py debug=$debug version=$version disableLog=$disableLog versionIP="${versionIP}" gameIP=$gameIP lang=$lang maintenanceIP=$maintenanceIP mode=$mode publishChannel=$publishChannel
killall Unity
$unity_app -quit -batchmode -projectPath $arpg_pro_dir -logFile ${log_dir}/${buid_name}.log -executeMethod XAsset.Build.AssetBuildScript.RunBuild version=$version channel=$channel outpath=$outpath development=$development versionIP=$versionIP lang=$lang buildNumber=$buildNumber rebuildBundle=$rebuildBundle mode=$mode target=$target publishChannel=$publishChannel graph=$build_graph thinkingAnalyticsMode=$thinkingAnalyticsMode
ret=$?
echo "buildFinish ret:${ret}"
resources=$arpg_cli_dir/arpg/Assets/RawResources
# svn add $resources/*.meta --force
# svn commit $resources -m "builder commit"
ui=$arpg_cli_dir/arpg/Assets/RawResources/UI
svn add $ui/*.meta --force
svn commit $ui -m "builder commit sprite tag"
ui2=$arpg_cli_dir/arpg/Assets/RawResources/UI2
svn add $ui2/*.meta --force
svn commit $ui2 -m "builder commit sprite tag"
if [ ! -f ${outpath} ]; then
echo "apk not found."
cat ${log_dir}/${buid_name}.log
exit 1
fi
echo "copy to www"
if [[ $root_dir =~ "@" ]]
then
if [ $mode == "aab" ]; then
scp $outpath $www_dir/release_aab/${build_file_name}
scp $output_dir/${buid_name}_original.aab $www_dir/original_aab/${buid_name}_original.aab
chmod 777 $output_dir/${buid_name}.apks
scp $output_dir/${buid_name}.apks $www_dir/apks/${buid_name}.apks
scp $output_dir/${version}_aab.zip $www_dir/split_assets/${version}_aab.zip
elif [ $mode == "apk" ]; then
scp $outpath $www_dir/apk/${build_file_name}
fi
else
if [ $mode == "aab" ]; then
cp -f $outpath $www_dir/release_aab/${build_file_name}
cp -f $output_dir/${buid_name}_original.aab $www_dir/original_aab/${buid_name}_original.aab
chmod 777 $output_dir/${buid_name}.apks
cp -f $output_dir/${buid_name}.apks $www_dir/apks/${buid_name}.apks
cp -f $output_dir/${version}_aab.zip $www_dir/split_assets/${version}_aab.zip
elif [ $mode == "apk" ]; then
cp -f $outpath $www_dir/apk/${build_file_name}
fi
fi
# if [ "$no_home_page" != "true" ]; then
# cd $www_dir/
# rm *.apk
# cp -f $outpath $www_dir/${buid_name}.apk
# rm -rf index.html
# echo "<!DOCTYPE html>
# <html>
# <head>
# <meta charset="utf-8">
# <title>IOS</title>
# </head>
# <body>
# <br><a href=\"itms-services://?action=download-manifest&url=https://192.168.1.245/app.plist\"><font size=\"100\">安装ios</font></a></br>
# <br><a href=\"/"${buid_name}".apk\"><font size=\"100\">"${buid_name}"</font></a></br>
# <br><a href=\"/server.crt\"><font size=\"100\">证书安装</font></a></br>
# <br><a href=\"/android\"><font size=\"100\">Android往期版本</font></a></br>
# <br><a href=\"/ios\"><font size=\"100\">ios往期版本</font></a></br>
# </body>
# </html>" > index.html
# fi
cd $output_dir
rm -rf *
echo "build success."
if [ $push_message == "true" ]; then
if [ $mode == "aab" ]; then
curl 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=228f1071-048b-479a-b250-3d22f2b92425' \
-H 'Content-Type: application/json charset=UTF-8"' \
-d "{\"msgtype\":\"markdown\", \"markdown\":{\"content\":\"## Android新版本\\n[${build_file_name}](http://192.168.1.245/arpg/android/release_aab/${build_file_name})\"}}"
elif [ $mode == "apk" ]; then
curl 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=228f1071-048b-479a-b250-3d22f2b92425' \
-H 'Content-Type: application/json charset=UTF-8"' \
-d "{\"msgtype\":\"markdown\", \"markdown\":{\"content\":\"## Android新版本\\n[${build_file_name}](http://192.168.1.245/arpg/android/apk/${build_file_name})\"}}"
fi
fi
echo "push message."
# scp -P 56000 $www_dir/${buid_name}.apk mmog@111.231.250.180:/data/wwwroot/arpgbuildapk/