办网站如何备案,柳市网站托管,网站建设网址,营销型网站建设的步骤流程是什么Fastlane一键打包上传到TestFlight、蒲公英 前言一、准备二、探索一、Fastlane配置1、Fastlane安装2、Fastlane更新3、Fastlane卸载4、查看Fastlane版本5、查看Fastlane位置6、Fastlane初始化 二、Fastlane安装蒲公英插件三、Fastlane文件编辑1、Gemfile文件2、Appfile文件3、F… Fastlane一键打包上传到TestFlight、蒲公英 前言一、准备二、探索一、Fastlane配置1、Fastlane安装2、Fastlane更新3、Fastlane卸载4、查看Fastlane版本5、查看Fastlane位置6、Fastlane初始化 二、Fastlane安装蒲公英插件三、Fastlane文件编辑1、Gemfile文件2、Appfile文件3、Fastfile文件1、递增build号2、任务配置 4、Pluginfile文件 四、项目工程配置Fastlane1、递增版本号配置 五、Fastlane执行2、账号权限 三、总结四、常见问题归纳 前言
废话不多说能知道fastlane的代表您已经对fastlane的用处有了初步了解并且想使用在自己项目中本文只适用于iOS项目的fastlane配置Android端未验证直接开始配置。
一、准备
Ruby环境CocoaPods环境 蒲公英官网打正式包上传testflight过程中需要输入密码对于开启了双重认证的账户需要去 申请专属密码app专属密码申请iOS开发必须要知道的基础开发环境配置终端执行pod env 登录蒲公英获取api_key复制备用
二、探索
一、Fastlane配置
1、Fastlane安装
终端执行以下命令以安装Fastlane 需要配置的安装
sudo gem install fastlane快速安装
sudo gem install fastlane -NV执行完成后出现以下字样即为安装成功
2、Fastlane更新
以下两种终端更新Fastlane方式使用一种即可
方式一
bundle update fastlane方式二
fastlane update_fastlane3、Fastlane卸载
终端执行以下命令来卸载Fastlane
sudo gem unstall fastlane4、查看Fastlane版本
执行以下命令查看Fastlane版本以验证
fastlane --version5、查看Fastlane位置
which fastlane6、Fastlane初始化
终端cd到项目工程根目录下执行以下命令来初始化fastlane
fastlane init项目工程里会创建出fastlane文件夹、Gemfile和Gemfile.lock 在fastlane init过程中有些需要输入开发者账号密码后续可通过以下命令重新登录账号。
fastlane cert create二、Fastlane安装蒲公英插件
终端执行以下命令来安装蒲公英插件
fastlane add_plugin pgyer执行过程中出现以下内容是为了在Gemfile文件里面写入Pluginfile内容输入y按回车
Plugin fastlane-plugin-pgyer was added to ./fastlane/Pluginfile
[10:08:29]: It looks like fastlane plugins are not yet set up for this project.
[10:08:29]: fastlane will modify your existing Gemfile at path Gemfile
[10:08:29]: This change is necessary for fastlane plugins to work
[10:08:29]: Should fastlane modify the Gemfile at path Gemfile for you? (y/n)出现以下内容即为安装蒲公英插件成功
三、Fastlane文件编辑
1、Gemfile文件
一般安装好蒲公英插件和fastlane初始化后会默认生成
source https://rubygems.orggem fastlanegem cocoapodsplugins_path File.join(File.dirname(__FILE__), fastlane, Pluginfile)
eval_gemfile(plugins_path) if File.exist?(plugins_path)2、Appfile文件
一般安装好蒲公英插件和fastlane初始化后会默认生成可以按需求修改个人的Apple ID方便接收AppStore上传及审核信息
app_identifier(com.xxx.xxx) #app的bundleID
apple_id(xxxxxx.com) #个人的Apple ID,邮箱itc_team_id(xxxxxx) #App Store的团队ID App Store Connect Team ID
team_id(xxxxxx) #团队ID Developer Portal Team ID
branch ENV[xxxxxx] #分支
# For more information about the Appfile, see:
# https://docs.fastlane.tools/advanced/#appfile
3、Fastfile文件
Fastfile文件为核心配置文件需要编辑打包流程到信息每一个功能块由 lane: xxx do 开头 end 结尾
1、递增build号
定义一个递增build号的函数添加到Fastfile中
def updateProjectBuildNumbercurrentTime Time.new.strftime(%Y%m%d)
build get_build_number()
if build.include?#{currentTime}.# 为当天版本 计算迭代版本号lastStr build[build.length-2..build.length-1]lastNum lastStr.to_ilastNum lastNum 1lastStr lastNum.to_sif lastNum 10lastStr lastStr.insert(0,0)endbuild #{currentTime}.#{lastStr}
else# 非当天版本 build 号重置build #{currentTime}.01
end
puts(*************| 更新build #{build} |*************)
# 更改项目 build 号
increment_build_number(
build_number: #{build}
)
end2、任务配置
以下为任务配置信息仅供参考请切换为属于你的专属信息
#fastlane版本号
fastlane_version 2.216.0
#打包平台
default_platform :ios#指定项目的scheme名称 ---- 修改
schemexxx
#蒲公英api_key和user_key ---- 修改
api_keyxxx
user_keyxxx# 任务脚本
platform :ios dodesc 以 development 方式打包并上传到蒲公英lane :test_beta doputs 以 development 方式打包gym(# 指定打包所使用的输出方式 (可选: app-store, package, ad-hoc, enterprise, development)export_method: development,# 指定项目的 scheme 名称scheme: xxx,# 指定输出的文件夹地址output_directory: ./archive/test_beta/ Time.new.strftime(%Y-%m-%d-%H:%M:%S),)puts 上传 ipa 包到蒲公英pgyer(# 蒲公英 API KEYapi_key: xxx,# 蒲公英 USER KEYuser_key: xxx)enddesc 以 ad-hoc 方式打包并上传到蒲公英lane :beta doputs 自动生成 Provisioning Profiles 文件sigh(# 指定输出的文件夹地址output_path: ./archive/sign,# 是否为 AdHoc 证书设为 false 或不写默认为 AppStore 证书adhoc: true)puts 以 ad-hoc 方式打包gym(# 指定打包所使用的输出方式 (可选: app-store, package, ad-hoc, enterprise, development)export_method: ad-hoc,# 指定项目的 scheme 名称scheme: xxx,# 指定输出的文件夹地址output_directory: ./archive/beta/ Time.new.strftime(%Y-%m-%d-%H:%M:%S),# 指定打包方式 (可选: Release, Debug)configuration: Release)puts 上传 ipa 包到蒲公英pgyer(# 蒲公英 API KEYapi_key: xxx,# 蒲公英 USER KEYuser_key: xxx)enddesc 以 app-store 方式打包并上传到 iTunes Connectlane :release doputs 自动生成 Provisioning Profiles 文件sigh(# 指定输出的文件夹地址output_path: ./archive/sign)puts 以 app-store 方式打包gym(# 指定打包所使用的输出方式 (可选: app-store, package, ad-hoc, enterprise, development)export_method: app-store,# 指定项目的 scheme 名称scheme: xxx,# 指定输出的文件夹地址output_directory: ./archive/release/ Time.new.strftime(%Y-%m-%d-%H:%M:%S),# 指定打包方式 (可选: Release, Debug)configuration: Release)puts 上传 ipa 包到 iTunes Connectdeliver(# 跳过截图上传skip_screenshots: true,# 跳过元数据上传skip_metadata: true,# 跳过审核直接上传force: true)end
end
以上配置完成就可以在本地终端进行打包了
export_method是在Fastlane工具中使用的命令指定导出iOS应用存档的方法以及可用的配置文件和签名证书。 以下是几种导出存档方法 app-store提交到应用商店的存档development用于开发目的的存档ad-hoc用于分发给有权限的设备或用户的存档enterprise公司内部网络分发的存档 configuration构建方式分Release和Debugscheme output_directory输出文件夹地址desc、puts信息描述
打开终端进入到项目fastlane文件夹上一级输入以下命令即可打一个以 development 方式打包并上传到蒲公英的包。
fastlane test_beta4、Pluginfile文件
一般安装好蒲公英插件后会默认生成
# Autogenerated by fastlane
#
# Ensure this file is checked in to source control!gem fastlane-plugin-pgyer四、项目工程配置Fastlane
1、递增版本号配置
修改Build Settings中的Versioning配置Current Project Version随便填一个Versioning System选择Apple Generic 修改info.plist File路径
五、Fastlane执行
做 fastlane 命令的时候都是在项目的根目录下进行的打开终端进入到项目fastlane文件夹上一级。
1获取到所有的 lane
fastlane lanes2、账号权限
1Adding a Credential(添加凭证) //输入命令
fastlane fastlane-credentials add --username felixkrausefx.com
//会自动要求输入密码App-Specific Passwords Password: *********(这里就是要输入刚刚生成的App-Specific Passwords)
如果手动输入错误请执行以下命令删除账号再重复添加凭证完成添加
2Removing a Credential(移除凭证)
fastlane fastlane-credentials remove --username felixkrausefx.com//password has been deleted.
三、总结
工具的使用没有什么技术含量想研究fastlane代码可参考github
四、常见问题归纳
1账号权限问题重复一下上面账号权限模块移除凭证添加凭证的命令步骤
[!] Error uploading ipa file:[Application Loader Error Output]: Error uploading /var/folders/sp/_4jyc68d0hvbm70nm50ljvvw0000gp/T/3a982536-cad1-483e-8b64-5c74740a168f.ipa.
[Application Loader Error Output]: Unable to upload archive. Failed to get authorization for username xxx126.com and password. (
[Application Loader Error Output]: The call to the altool completed with a non-zero exit status: 1. This indicates a failure.