Android 测试版自动化打包

  1. # 切换分支
  2. git checkout release
  3. git pull origin release
  4. # 开启flutter编译
  5. flutter build apk
  6. #导出.ipa文件所在路径
  7. exportFilePath=./build/app/outputs/apk/release/app-release.apk
  8. echo "开始上传到fir"
  9. #上传到Fir
  10. # 将XXX替换成自己的Fir平台的token
  11. fir login -T xxx
  12. fir publish $exportFilePath
  13. echo '///------------'
  14. echo '/// 发布完成,开始通知到钉钉群 '
  15. echo '///------------'
  16. curl 'https://oapi.dingtalk.com/robot/send?access_token=xxx' \
  17. -H 'Content-Type: application/json' \
  18. -d '{
  19. "msgtype": "markdown",
  20. "markdown": {
  21. "title":"医生工作台App打包报告",
  22. "text": "#### 打包成功\n > 平台:Andriod \n\n > 模式:debug \n\n > [传送门](http://d.firim.top/doctorTes)"
  23. },
  24. "at": {
  25. "atMobiles": [
  26. "177****xxx",
  27. ],
  28. "isAtAll": false
  29. }
  30. }'
  31. echo "\n\n"
  32. echo "已运行完毕>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
  33. exit 0

IOS 测试版自动化打包

  1. # 切换分支
  2. git checkout release
  3. git pull origin release
  4. # 开启flutter编译
  5. flutter build ios
  6. # 下载IOS依赖
  7. cd ios/
  8. pod install
  9. # 开始自动打包
  10. if [ ! -d ./IPADir ];
  11. then
  12. mkdir -p IPADir;
  13. fi
  14. #工程名 # workspace
  15. project_name=puleDoctor
  16. # xcodeproj目录
  17. xcodeworkspacePath=./Runner.xcworkspace
  18. #打包模式 Debug/Release
  19. development_mode=Release
  20. # target
  21. #scheme名 白名单 --- 平台机制: qq <--> wechat
  22. scheme_name=Runner
  23. ipa_name=普乐医生
  24. #plist文件所在路径--->描述文件 method (appstore adhoc)
  25. exportOptionsPlistPath=./DevExportOptionsPlist.plist
  26. #导出.ipa文件所在路径
  27. exportFilePath=./output/$project_name-ipa
  28. # xcodebuild 命令 archive build clearn ....
  29. # echo '*** 正在 清理工程 ***'
  30. # xcodebuild \
  31. # clean -configuration ${development_mode} -quiet || exit
  32. # echo '*** 清理完成 ***'
  33. # 归档
  34. echo '*** 正在 编译工程 For '${development_mode}
  35. xcodebuild \
  36. archive -workspace ${xcodeworkspacePath} \
  37. -scheme ${scheme_name} \
  38. -configuration ${development_mode} \
  39. -archivePath autobuild/${project_name}.xcarchive -quiet || exit
  40. echo '*** 编译完成 ***'
  41. echo '*** 正在 打包 ***'
  42. xcodebuild -exportArchive -archivePath autobuild/${project_name}.xcarchive \
  43. -configuration ${development_mode} \
  44. -exportPath ${exportFilePath} \
  45. -exportOptionsPlist ${exportOptionsPlistPath} \
  46. -quiet || exit
  47. # 删除build包
  48. if [[ -d autobuild ]]; then
  49. rm -rf autobuild -r
  50. fi
  51. if [ -e $exportFilePath/$ipa_name.ipa ];
  52. then
  53. echo '///----------'
  54. echo '/// ipa包已导出'
  55. echo '///----------'
  56. # open $exportFilePath
  57. else
  58. echo '///-------------'
  59. echo '/// ipa包导出失败 '
  60. echo '///-------------'
  61. fi
  62. echo '///------------'
  63. echo '/// 打包ipa完成,开始发布ipa包 '
  64. echo '///------------'
  65. echo "开始上传到fir"
  66. #上传到Fir
  67. # 将XXX替换成自己的Fir平台的token
  68. fir login -T xxx
  69. fir publish $exportFilePath/$ipa_name.ipa
  70. echo '///------------'
  71. echo '/// 发布完成,开始通知到钉钉群 '
  72. echo '///------------'
  73. curl 'https://oapi.dingtalk.com/robot/send?access_token=xxx' \
  74. -H 'Content-Type: application/json' \
  75. -d '{
  76. "msgtype": "markdown",
  77. "markdown": {
  78. "title":"xxxApp打包报告",
  79. "text": "#### 打包成功\n > 平台:IOS \n\n > 模式:debug \n\n > [传送门](http://d.firim.top/xxx)"
  80. },
  81. "at": {
  82. "atMobiles": [
  83. "177****xxx",
  84. ],
  85. "isAtAll": false
  86. }
  87. }'
  88. echo "\n\n"
  89. echo "已运行完毕>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
  90. exit 0

安装fir上传插件:gem install fir-cli 如果执行.sh文件出现“Permission Denied”, 请执行命令 chmod a+x xxx.sh