关键词:
最近有空, 搞一搞fastlane 一键打包发布App store / testflight / fir.com
相关资料
安装fastlane
brew install fastlane
fastlane的安装和使用
Fastlane 官方文档
fastlane自动化打包(android)
fastlane - fastfile一些基础
idea使用vs code , 可以安装一些代码片段插件,快速上手
如何传参
传参写法
desc "Add description of lane"
lane :test1 do |options|
puts(options[:arg1])
puts(options[:arg2])
puts(options[:arg3])
end
命令行调用
fastlane test1 arg1:a arg2:b arg3:c
日志输出
[✔] 🚀
[14:33:30]: ------------------------------
[14:33:30]: --- Step: default_platform ---
[14:33:30]: ------------------------------
[14:33:30]: Driving the lane 'ios test1' 🚀
[14:33:30]: a
[14:33:30]: b
[14:33:30]: c
+------+------------------+-------------+
| fastlane summary |
+------+------------------+-------------+
| Step | Action | Time (in s) |
+------+------------------+-------------+
| 1 | default_platform | 0 |
+------+------------------+-------------+
[14:33:30]: fastlane.tools finished successfully 🎉
issuer_id
这个必须是主账户才能看到
如果提示找不到 p8 file, 记得检查一下路径, 要在fastlane 路径下, 如果是
./
路径, 会报错
key_filepath: ‘./fastlane/AuXXXX.p8’,
app_store_connect_api_key(
key_id: "D83848D23",
issuer_id: "227b0bbf-ada8-458c-9d62-3d8022b7d07f",
key_filepath: "D83848D23.p8",
duration: 200,
in_house: true
)
iOS端 步骤 (默认已经做好环境配置)
1.cd ios
2.fastlane init
3.编写 Fastfile 文件
4. .p8文件放入 ./fastlane文件目录
5. Fastfile文件代码如下
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
# https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
# https://docs.fastlane.tools/plugins/available-plugins
#
# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane
default_platform(:ios)
platform :ios do
desc "test"
lane :test do |options|
#add actions here
puts(Dir.pwd)
puts("test ----> 1")
end
desc "打包iOS+上传"
lane :app do |options|
# 数据变量部分
targetName = "channelMarketing"
scheme = targetName
fastlane = "fastlane"
ipa = "ipa"
workspace = targetName+".xcworkspace"
workspace_path = './'+workspace
output_directory = './'+fastlane+"/"+ipa
output_name = targetName + ".ipa"
# 自增build版本号
increment_build_number()
gym(
clean:true, # 打包前先clean一下
workspace:workspace,
configuration:'Release',
scheme:scheme,
silent:false, # 隐藏构建时不需要的所有信息 默认false
output_directory:output_directory,
output_name:output_name,
include_symbols:true,
export_method: 'app-store', # app-store | ad-hoc | development 等
export_xcargs: '-allowProvisioningUpdates'
)
# 获取ipa路径
ipa_file_path = lane_context[SharedValues::IPA_OUTPUT_PATH]
# 获取ipa基本信息
app_name = get_ipa_info_plist_value(ipa: ipa_file_path, key: "CFBundleDisplayName")
package_name = get_ipa_info_plist_value(ipa: ipa_file_path, key: "CFBundleIdentifier")
version_name = get_ipa_info_plist_value(ipa: ipa_file_path, key: "CFBundleShortVersionString")
version_code = get_ipa_info_plist_value(ipa: ipa_file_path, key: "CFBundleVersion")
puts("iPA基本信息: app_name = " + app_name);
puts("iPA基本信息: package_name = " + package_name);
puts("iPA基本信息: version_name = " + version_name);
puts("iPA基本信息: version_code = " + version_code);
# 复制一份ipa + 修改复制文件 包名
sh("open ./ipa")
changeName_cp = "cp"
changeName_file_org = "./"+ipa+"/"+output_name
changeName_file_new = "./"+ipa+"/"+targetName+"_"+version_name+"_"+version_code+".ipa";
sh(changeName_cp +" "+ changeName_file_org +" "+ changeName_file_new)
# 3.上传
api_key = app_store_connect_api_key(
key_id: 'xxxxxxx',#自行配置
issuer_id: 'xxxxxxx',#自行配置
key_filepath: './fastlane/xxxxxx.p8', #自行配置
duration: 1200,
in_house: false
)
# 上传到testflight
upload_to_testflight(
# 上边设置的授权信息
api_key: api_key,
skip_waiting_for_build_processing: true,
# 打包好要上传的文件
ipa: ipa_file_path,
skip_submission: true
)
end
# 提交一下git
after_each do |lane, options|
# ...
puts(Dir.pwd)
# 提交变动的build号
sh("cd .. && cd .. && git add . && git commit -m -a")
end
end
android端 步骤 (默认已经做好环境配置)
1.cd ios
2.fastlane init
3. 安装一些插件
fastlane add_plugin firim
安装插件的一些坑
踩坑1:
踩坑2 上传 fir.im
可是使用fastlane的插件 fir-im, 这里我采用了fir-cli, 直接走脚本上传了,
直接用fir-cli提供的命令行工具
在 lane中添加 就可以上传
sh "fir publish xxxxx your apk file xxxxxxx -T xxxxxxxxyou tokenxxxxxxxx"
当然安装插件的踩坑也是有的,主要是因为 Gemfile文件路径的问题
安卓根目录下 Gemfile 与 fastlane 同级
Could not find gem 'fir' in any of the gem sources listed in your Gemfile.
报错:
由于我在Android项目根目录下创建的 fastlane init 所以,Gemfile文件里面 plugins_path
要注意下获取路径
原Gemfile文件对 plugins_path
路径的写法为:
plugins_path = File.join(File.dirname(__FILE__), '.', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)
这边改为:
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)
fir.im:80
报错:
遇到这个报错,主要还是fir-cli的版本过低,新版本升级后就替换了新域名
fir.im 更换域名至 betaqr.com 后, 需要升级至 fir-cli >= 2.0.4 有部分用户反馈 2.0.2 无法直接使用 gem update fir-cli 升级到 2.0.4, 则可以尝试卸载后重新安装, 即 gem uninstall fir-cli 后 gem install fir-cli
踩坑3: lane 中执行 sh "fir version"失败
can't find executable fir for gem fir-cli. fir-cli is not currently included in the bundle, perhaps you meant to add it to your Gemfile? (Gem::Exception)
问题还是出在Gemfile中, 确保其中有
gem "fastlane"
gem "fir"
Fastfile文件:
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
# https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
# https://docs.fastlane.tools/plugins/available-plugins
#
# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane
default_platform(:android)
platform :android do
desc "package"
lane :app do |options|
gradle(
task: 'assemble',
build_type: 'Release',
properties:
"android.injected.signing.store.file" => Dir.pwd + "/xxxxx",
"android.injected.signing.store.password" => "xxxxxxxx",
"android.injected.signing.key.alias" => "xxxxxx",
"android.injected.signing.key.password" => "xxxxxxxx",
,
);
end
after_each do |lane, options|
# ...
apk_name = "xxxxxx.apk"
apk_path = Dir.pwd+"/"+apk_name
fir_token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
apk_file_path = lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH];
build_type = lane_context[SharedValues::GRADLE_BUILD_TYPE];
sh("cp #apk_file_path #apk_path")
sh("fir version")
sh("fir login #fir_token")
sh "fir me"
sh "fir publish #apk_path"
sh("open .")
end
end
fastlane-app自动编译打包多个版本上传到appstore
Fastlane是一套使用Ruby写的自动化工具集,用于iOS和Android的自动化打包、发布等工作,可以节省大量的时间。Github:https://github.com/fastlane/fastlane官网:https://fastlane.tools/文档:https://docs.fastlane.tools/安装1、首先要安装正确的Ruby版本... 查看详情
食堂app-项目开发及踩坑记录(10)
------------恢复内容开始------------实现APP中远程访问调用servlet并返回数据, privatevoidsend(){//开启线程,发送请求newThread(newRunnable(){@Overridepublicvoidrun(){HttpURLConnectionconnection=null;BufferedReaderreader=null;tr 查看详情
html网站网址一键打包成app平台-开心app平台
开心APP在线打包平台可以快速封装网站变成APP,一键打包网站APP平台的出现,极大的降低的开发费用,几百块就可以制作一个体验不错的APP。 网站封装成APP的流程方便快捷!无需懂代码,会上网就能制作APP! 下面介绍使... 查看详情
自动化打包之fastlane--代码签名和项目配置(代码片段)
自动化打包之fastlane–(1)研究之必须提前了解的几点自动化打包之fastlane–(2)fastlaneinit图文教程自动化打包之fastlane–(3)安装fir插件图文教程自动化打包之fastlane–(4)安装其他插件自动化打包之fastlane–(5)自动打包到蒲公英自动化... 查看详情
交付到 App Store 时,Fastlane 框架不支持的屏幕尺寸
】交付到AppStore时,Fastlane框架不支持的屏幕尺寸【英文标题】:FastlaneframeitunsupportedscreensizewhendelivertoAppstore【发布时间】:2019-04-0911:51:52【问题描述】:使用Swift5、iOS-12.2、Xcode-10.2(10E125)并使用GitLabCI运行一切,在应用发布步骤... 查看详情
如何让fastlane兼容iOS13
】如何让fastlane兼容iOS13【英文标题】:howtomakefastlanecompatiblewithiOS13【发布时间】:2019-10-1803:43:03【问题描述】:我正在使用fastlane打包我的应用程序,我在我的应用程序中编写了一些ios13支持的类,例如UIStatusBarManager类,然后它... 查看详情
即使使用 API 密钥,Fastlane 上传到 App Store 也会在非交互模式下失败
】即使使用API密钥,Fastlane上传到AppStore也会在非交互模式下失败【英文标题】:FastlaneuploadtoAppStorefailsinnon-interactivemodeevenwithAPIkey【发布时间】:2021-04-2122:22:35【问题描述】:我在GitLabCI环境中使用Fastlane。我正在使用API密钥并已... 查看详情
微信小程序使用towxml解析html流程及踩坑记录
...开发者还算比较友好,个人是建议在wxParse没有完善之前使用towxml这个库来解析html以及markdown格式。我这里使用的是绝对路径,各位同学根据自己的存放路径修改这里模板名称固定,data固定写法为...解析后的变量名 查看详情
fastlane自动化打包报错:anexceptionhasoccurred:issueridisrequired(代码片段)
一周没有使用fastlane打包,报错提示issuerIdisrequired最后,在去fastlane的git查到了gitHub-fastlane#20741意思是苹果最新的Transporter3.0.0版本存在不兼容bug,推荐大家回退到2.3.0老版本可以有效但是问题是:Transporter用户指南3.0-安装Transporter下载... 查看详情
使用 fastlane 的两因素身份验证
】使用fastlane的两因素身份验证【英文标题】:Two-factorAuthenticationWithfastlane【发布时间】:2020-12-0923:15:59【问题描述】:我在使用CI机器时将我的应用程序发布到Firebase分发抛出Fastlane。我面临2FA的问题。我正在使用Match来检索我... 查看详情
如何使用 fastlane Deliver 向 iTunes Connect 提交“Beta App Description”
】如何使用fastlaneDeliver向iTunesConnect提交“BetaAppDescription”【英文标题】:Howtosubmit"BetaAppDescription"toiTunesConnectwithfastlanedeliver【发布时间】:2017-12-1220:02:44【问题描述】:我使用fastlanedeliver将我的iOS应用和大部分应用元数... 查看详情
萝卜新版app一键云端打包/无需电脑/无需as工具
...f0c;如果会自己打包的可以下载前端源码,使用下面的一键打包就不用下载前端源码,下载后端源码搭建即可,或者用脚本一键前后端。打包APP教程手机电脑都可以。需要的东西:一个linux服务器,能打开宝塔里面的... 查看详情
如何使用 .env 文件覆盖 fastlane 的 appfile 中的值
】如何使用.env文件覆盖fastlane的appfile中的值【英文标题】:Howtooverridevaluesinsidefastlane\'sappfileusing.envfiles【发布时间】:2016-05-0517:59:47【问题描述】:在某些情况下,我们需要覆盖fastlane的appfile中的值,例如使用不同的苹果账号... 查看详情
ios自动打包并发布到fir.im(代码片段)
...。于是就研究了一下自动打包ipa这个功能二、牛逼的工具fastlanefastlane这个工具牛逼之处就是几乎包含了和ipa相关的所有功能,例如打包、提交审核、测试、自动截屏等等。这里就主要介绍一下其中的打包工具gym。三、实现原... 查看详情
go包管理工具-glide使用方法及踩坑记录(代码片段)
前言大学以来一直想做一个OJ,终于可以开始,而且是用新学的Go来写,心里还是挺兴奋的。项目启动,要搭架子,第一件事,当然是选择一个包管理工具。Go的包管理还是挺混乱的,没有一个能像Java的... 查看详情
jenkinspipeline的语法实例介绍及踩坑记录(代码片段)
本文介绍一下Jenkinspipeline的语法实例介绍及踩坑记录废话不多说,直接上案例pipelineagentanystagesstage(‘download‘)stepsecho‘Thisisabuildstep‘gitcredentialsId:‘0c3d0852-8a03-42e2-a893-a445308a257b‘,url:‘http://192.168.0.6/softwa 查看详情
fastlane的build_app中codesigning_identity的值是多少
】fastlane的build_app中codesigning_identity的值是多少【英文标题】:Whatisthevalueofcodesigning_identityinbuild_appoffastlane【发布时间】:2020-09-0307:06:05【问题描述】:我试图使用这条快车道script。该脚本最终失败,因为它选择了错误的codesigning... 查看详情
如何使用 fastlane 操作修改 iOS 应用程序图标?
】如何使用fastlane操作修改iOS应用程序图标?【英文标题】:HowtomodifyiOSAppIconwithfastlaneaction?【发布时间】:2019-06-2514:22:36【问题描述】:我使用Fastlane操作将应用上传到TestFlight,并且我想修改应用图标。在Xcode中,Targets的BuildSett... 查看详情