Android 测试版自动化打包
# 切换分支
git checkout release
git pull origin release
# 开启flutter编译
flutter build apk
#导出.ipa文件所在路径
exportFilePath=./build/app/outputs/apk/release/app-release.apk
echo "开始上传到fir"
#上传到Fir
# 将XXX替换成自己的Fir平台的token
fir login -T xxx
fir publish $exportFilePath
echo '///------------'
echo '/// 发布完成,开始通知到钉钉群 '
echo '///------------'
curl 'https://oapi.dingtalk.com/robot/send?access_token=xxx' \
-H 'Content-Type: application/json' \
-d '{
"msgtype": "markdown",
"markdown": {
"title":"医生工作台App打包报告",
"text": "#### 打包成功\n > 平台:Andriod \n\n > 模式:debug \n\n > [传送门](http://d.firim.top/doctorTes)"
},
"at": {
"atMobiles": [
"177****xxx",
],
"isAtAll": false
}
}'
echo "\n\n"
echo "已运行完毕>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
exit 0
IOS 测试版自动化打包
# 切换分支
git checkout release
git pull origin release
# 开启flutter编译
flutter build ios
# 下载IOS依赖
cd ios/
pod install
# 开始自动打包
if [ ! -d ./IPADir ];
then
mkdir -p IPADir;
fi
#工程名 # workspace
project_name=puleDoctor
# xcodeproj目录
xcodeworkspacePath=./Runner.xcworkspace
#打包模式 Debug/Release
development_mode=Release
# target
#scheme名 白名单 --- 平台机制: qq <--> wechat
scheme_name=Runner
ipa_name=普乐医生
#plist文件所在路径--->描述文件 method (appstore adhoc)
exportOptionsPlistPath=./DevExportOptionsPlist.plist
#导出.ipa文件所在路径
exportFilePath=./output/$project_name-ipa
# xcodebuild 命令 archive build clearn ....
# echo '*** 正在 清理工程 ***'
# xcodebuild \
# clean -configuration ${development_mode} -quiet || exit
# echo '*** 清理完成 ***'
# 归档
echo '*** 正在 编译工程 For '${development_mode}
xcodebuild \
archive -workspace ${xcodeworkspacePath} \
-scheme ${scheme_name} \
-configuration ${development_mode} \
-archivePath autobuild/${project_name}.xcarchive -quiet || exit
echo '*** 编译完成 ***'
echo '*** 正在 打包 ***'
xcodebuild -exportArchive -archivePath autobuild/${project_name}.xcarchive \
-configuration ${development_mode} \
-exportPath ${exportFilePath} \
-exportOptionsPlist ${exportOptionsPlistPath} \
-quiet || exit
# 删除build包
if [[ -d autobuild ]]; then
rm -rf autobuild -r
fi
if [ -e $exportFilePath/$ipa_name.ipa ];
then
echo '///----------'
echo '/// ipa包已导出'
echo '///----------'
# open $exportFilePath
else
echo '///-------------'
echo '/// ipa包导出失败 '
echo '///-------------'
fi
echo '///------------'
echo '/// 打包ipa完成,开始发布ipa包 '
echo '///------------'
echo "开始上传到fir"
#上传到Fir
# 将XXX替换成自己的Fir平台的token
fir login -T xxx
fir publish $exportFilePath/$ipa_name.ipa
echo '///------------'
echo '/// 发布完成,开始通知到钉钉群 '
echo '///------------'
curl 'https://oapi.dingtalk.com/robot/send?access_token=xxx' \
-H 'Content-Type: application/json' \
-d '{
"msgtype": "markdown",
"markdown": {
"title":"xxxApp打包报告",
"text": "#### 打包成功\n > 平台:IOS \n\n > 模式:debug \n\n > [传送门](http://d.firim.top/xxx)"
},
"at": {
"atMobiles": [
"177****xxx",
],
"isAtAll": false
}
}'
echo "\n\n"
echo "已运行完毕>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
exit 0
安装fir上传插件:gem install fir-cli 如果执行.sh文件出现“Permission Denied”, 请执行命令 chmod a+x xxx.sh