自习室优化ok
This commit is contained in:
26
build.prod.sh
Normal file
26
build.prod.sh
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
#当前执行目录
|
||||
current_dir=$(pwd)
|
||||
channelPath="$current_dir/build/app/outputs/apk/release"
|
||||
mkdir -p "$channelPath"
|
||||
rm -rf "$channelPath"/*
|
||||
#定义环境变量和 Android 设备品牌
|
||||
declare -a APP_CHANNELS=("release")
|
||||
|
||||
# 遍历每个环境配置并执行构建
|
||||
for index in "${APP_CHANNELS[@]}"; do
|
||||
ENV=${APP_CHANNELS[$index]}
|
||||
flutter build apk -Penv=prod -Pchannel=$ENV
|
||||
# 检查构建是否成功
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Build failed for ENV=$ENV"
|
||||
exit 1
|
||||
fi
|
||||
apkFile=$(find $(pwd)/build/app/outputs/apk/release/ -name "*.apk" -print -quit)
|
||||
# 获取 .apk 文件的文件名
|
||||
apkFileName=$(basename "$apkFile")
|
||||
mv $apkFile "$channelPath/$apkFileName"
|
||||
done
|
||||
|
||||
echo "All builds completed successfully."
|
||||
Reference in New Issue
Block a user