美文网首页
Fastlane安装和使用,发布测试包到firim

Fastlane安装和使用,发布测试包到firim

作者: Ray0218 | 来源:发表于2019-01-28 17:50 被阅读0次

1、安装 RVM

RVM:Ruby Version Manager,Ruby版本管理器,包括Ruby的版本管理和Gem库管理(gemset)

\curl -L https://get.rvm.io | bash -s stable --ruby

等待一段时间后就可以成功安装好 RVM。

$ source ~/.bashrc

$ source ~/.bash_profile

测试是否安装正常

rvm -v

2.更新ruby版本,安装rvm

 curl -L get.rvm.io | bash -s stable 

测试是否安装正常 rvm -v 

列出已知ruby版本:rvm list known 

安装一个ruby版本:rvm install 2.6.0

使用一个ruby版本:rvm use 2.6.0

设置默认版本: rvm use 2.6.0 --default

 卸载:rvm remove 2.0.0

3 , 查看当前的gem源

gem sources 

*** CURRENT SOURCES ***

https://rubygems.org

如源路径不是https://gems.ruby-china.com/修改 ruby的镜像文件路径改为https://gems.ruby-china.com/

gem sources --remove https://rubygems.org

gem sources --add https://rubygems.org

# 清空源缓存

gem sources -c

# 更新源缓存

gem sources -u

更新gem版本,然后再次安装Fastlane:

sudo gem update--system

sudo gem install fastlane -NV

4.安装gemfile文件

https://www.jianshu.com/p/32fcdeb5bbec

如果使用cocoapod,必须要在Gemfile文件里添加   gem"cocoapods"

5,插件安装

Fastlane的插件是一个或者一组action的打包,单独发布在fastlane之外。Fastlane Plugin 指南

可以输入

fastlane search_plugins

查找相应的插件

安装插件方法

fastlane add_plugin [name]# 安装方法

安装插件(版本和firim插件)

fastlane add_plugin versioning# 用来修改build版本号和version版本号。

fastlane add_plugin firim #firim插件

6, 配置fastlane:切换目录到包含xxx.xcodeproj的项目目录下输入

fastlane init

输出:

[15:21:56]: What would you like to use fastlanefor?1. 📸  Automate screenshots2. 👩‍✈️  Automate beta distribution to TestFlight3. 🚀  Automate App Store distribution4. 🛠  Manual setup - manually setup your project to automate your tasks?

这四个选项的意思是

1. 自动截屏。这个功能能帮我们自动截取APP中的截图,并添加手机边框(如果需要的话),我们这里不选择这个选项,因为我们的项目已经有图片了,不需要这里截屏。

2. 自动发布beta版本用于TestFlight,如果大家有对TestFlight不了解的,可以参考王巍写的这篇文章

3. 自动的App Store发布包。我们的目标是要提交审核到APP Store,按道理应该选这个,但这里我们先不选,因为选择了以后会需要输入用户名密码,以及下载meta信息,需要花费一定时间,这些数据我们可以后期进行配置。

4. 手动设置。

发布脚本配置  https://whlsxl.github.io/

更新当前bundle到最新版本

 bundle update --bundler

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 "Push a new release build to the App Store"

lane :release do

    build_app(workspace: "TestObject.xcworkspace", scheme: "TestObject")

    upload_to_app_store

  end

lane :to_firim do

  # 如果你用 pod install

  cocoapods

  # 如果你没有申请adhoc证书,sigh会自动帮你申请,并且添加到Xcode里

  sigh(adhoc: true)

  # 以下两个action来自fastlane-plugin-versioning,

  # 第一个递增 Build,第二个设定Version。

  # 如果你有多个target,就必须指定target的值,否则它会直接找找到的第一个plist修改

  # 在这里我建议每一个打的包的Build都要不一样,这样crash了拿到日志,可以对应到ipa上

  increment_build_number_in_plist(target: "TestObject")

  increment_version_number_in_plist(

    target: "TestObject",

    version_number: '1.0.0'

    )

  # gym用来编译ipa

  gym(

    output_directory: './firim',

    export_options: {

      method: "ad-hoc", # 指定打包方式

      teamID: "78ASKeG7F3",

      thinning: "<none>"

    },

    scheme: "TestObject",

#output_name: "TestObject.ipa"

    )

  # 上传ipa到fir.im服务器,在fir.im获取firim_api_token

  firim(firim_api_token: "dc42c6ffcdcd2766bfe881d0e6d81b12")

end

end

参考

https://www.jianshu.com/p/2918cf082b9d

https://whlsxl.github.io/

https://www.jianshu.com/p/32fcdeb5bbec

https://www.jianshu.com/p/cdf580a4cd67

相关文章

网友评论

      本文标题:Fastlane安装和使用,发布测试包到firim

      本文链接:https://www.haomeiwen.com/subject/zhkdhttx.html