└── fastlane ├── report.xml ├── README.md └── Fastfile /fastlane/report.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /fastlane/README.md: -------------------------------------------------------------------------------- 1 | fastlane documentation 2 | ================ 3 | # Installation 4 | 5 | Make sure you have the latest version of the Xcode command line tools installed: 6 | 7 | ``` 8 | xcode-select --install 9 | ``` 10 | 11 | Install _fastlane_ using 12 | ``` 13 | [sudo] gem install fastlane -NV 14 | ``` 15 | or alternatively using `brew cask install fastlane` 16 | 17 | # Available Actions 18 | ## iOS 19 | ### ios addUdids 20 | ``` 21 | fastlane ios addUdids 22 | ``` 23 | 注册手机udid到指定AppId账号 24 | ### ios downloadsProfile 25 | ``` 26 | fastlane ios downloadsProfile 27 | ``` 28 | 下载provisioning_profile,不存在的bundleid和certificates自动新建并下载 29 | ### ios adhoc_profile 30 | ``` 31 | fastlane ios adhoc_profile 32 | ``` 33 | 单纯下载provisioning_profile,不存在的bundleid自动新建并下载(已废弃) 34 | ### ios test 35 | ``` 36 | fastlane ios test 37 | ``` 38 | 39 | 40 | ---- 41 | 42 | This README.md is auto-generated and will be re-generated every time [fastlane](https://fastlane.tools) is run. 43 | More information about fastlane can be found on [fastlane.tools](https://fastlane.tools). 44 | The documentation of fastlane can be found on [docs.fastlane.tools](https://docs.fastlane.tools). 45 | -------------------------------------------------------------------------------- /fastlane/Fastfile: -------------------------------------------------------------------------------- 1 | # This file contains the fastlane.tools configuration 2 | # You can find the documentation at https://docs.fastlane.tools 3 | # 4 | # For a list of all available actions, check out 5 | # 6 | # https://docs.fastlane.tools/actions 7 | # 8 | # For a list of all available plugins, check out 9 | # 10 | # https://docs.fastlane.tools/plugins/available-plugins 11 | # 12 | 13 | # Uncomment the line if you want fastlane to automatically update itself 14 | # update_fastlane 15 | 16 | default_platform(:ios) 17 | 18 | platform :ios do 19 | desc "注册手机udid到指定AppId账号" 20 | lane :addUdids do |option| 21 | #接收到的所有参数 22 | puts "接收到的所有参数 #{option}" 23 | udidsStr = option[:udids] 24 | username = option[:appleid] 25 | if option.keys.size>0 26 | #字符串 -> 数组 27 | udidsArray = udidsStr.split(",") 28 | puts "需要添加的udid集合 #{udidsArray}" 29 | #数组 -> 字典(hash) 30 | udidsDic = {} 31 | for tmpUdid in udidsArray do 32 | tmpDic = {tmpUdid => tmpUdid} 33 | udidsDic = udidsDic.merge tmpDic 34 | end 35 | puts udidsDic 36 | #添加udid 37 | register_devices( 38 | devices:udidsDic, 39 | username: username, 40 | ) 41 | elsif 42 | puts "⚠️ ⚠️ ⚠️ udids集合为空 ⚠️ ⚠️ ⚠️" 43 | end 44 | end 45 | 46 | 47 | #sign使用参考https://docs.fastlane.tools/actions/sigh/ 48 | desc "下载provisioning_profile,不存在的bundleid和certificates自动新建并下载" 49 | lane :downloadsProfile do |option| 50 | #接收到的所有参数 51 | puts "接收到的所有参数 #{option}" 52 | bundleid = option[:bundleid] #bundleid 53 | username = option[:appleid] #Apple ID用户名 54 | name = option[:name] #Apple Developer Portal上使用的配置文件的名称 55 | cer = option[:cer] #0证书已经表示存在 1表示不存在 56 | mobileprovision = option[:mobileprovision] #0描述文件已经表示存在 1表示不存在 57 | #如果没有在Apple Developer创建证书的话,get_certificates会帮你自动创建证书 58 | puts "cer=#{cer}" 59 | puts "mobileprovision=#{mobileprovision}" 60 | if cer.to_i == 1 61 | get_certificates( 62 | username: username, 63 | #keychain_password: "123", 64 | ) 65 | else 66 | puts "certificates已存在,跳过创建步骤" 67 | end 68 | 69 | #在开发者账号创建appid(此方法待优化,比较耗时) 70 | if mobileprovision.to_i == 1 71 | produce( 72 | username:username, 73 | app_identifier: bundleid, 74 | app_name: bundleid, 75 | ) 76 | else 77 | puts "mobileprovision已存在,跳过创建步骤" 78 | end 79 | initError = "" 80 | if bundleid==nil 81 | initError = "⚠️ ⚠️ ⚠️ bundleid(bundleid)为空,请补充 ⚠️ ⚠️ ⚠️" 82 | elsif username==nil 83 | initError = "⚠️ ⚠️ ⚠️ appleid(Apple ID用户名)为空,请补充 ⚠️ ⚠️ ⚠️" 84 | elsif name==nil 85 | initError = "⚠️ ⚠️ ⚠️ name(配置文件名称)为空,请补充 ⚠️ ⚠️ ⚠️" 86 | else 87 | puts "参数获取正常" 88 | end 89 | if initError.length==0 90 | sigh( 91 | username:username, 92 | app_identifier: bundleid, 93 | force: true, 94 | provisioning_name: name, 95 | ignore_profiles_with_different_name: true, 96 | adhoc: true, 97 | ) 98 | else 99 | puts initError 100 | end 101 | end 102 | 103 | desc "单纯下载provisioning_profile,不存在的bundleid自动新建并下载(已废弃)" 104 | lane :adhoc_profile do |option| 105 | #接收到的所有参数 106 | puts "接收到的所有参数 #{option}" 107 | bundleid = option[:bundleid] #bundleid 108 | username = option[:appleid] #Apple ID用户名 109 | name = option[:name] #Apple Developer Portal上使用的配置文件的名称 110 | get_provisioning_profile( 111 | username:username, 112 | adhoc: true, 113 | force: true, 114 | filename: "name.mobileprovision", 115 | app_identifier: bundleid, 116 | ) 117 | end 118 | 119 | lane :test do |option| 120 | #接收到的所有参数 121 | puts "接收到的所有参数 #{option}" 122 | bundleid = option[:bundleid] #bundleid 123 | username = option[:appleid] #Apple ID用户名 124 | name = option[:name] #Apple Developer Portal上使用的配置文件的名称 125 | puts "请输入版本描述:" 126 | desc = STDIN.gets 127 | puts "开始打包 #{desc}" 128 | end 129 | 130 | 131 | 132 | before_all do |options| 133 | puts "🚀🚀🚀 fastlane 初始化准备执行 🚀🚀🚀" 134 | end 135 | 136 | before_each do |options| 137 | puts "🚀🚀🚀 lane #{options}初始化准备执行 🚀🚀🚀" 138 | end 139 | 140 | after_each do |options| 141 | puts "🚀🚀🚀 lane #{options}执行完成 🚀🚀🚀" 142 | end 143 | 144 | after_each do |options| 145 | puts "🚀🚀🚀 fastlane 完成执行 🚀🚀🚀" 146 | end 147 | 148 | error do |options| 149 | puts "⚠️ ⚠️ ⚠️ lane #{options}出现错误 ⚠️ ⚠️ ⚠️" 150 | end 151 | 152 | end 153 | --------------------------------------------------------------------------------