Fastlane是一套使用Ruby写的自动化工具集,旨在简化Android和iOS的部署过程,自动化你的工作流。它可以简化一些乏味、单调、重复的工作,像截图、代码签名以及发布App。
一、fastlane安装
# Using RubyGems
sudo gem install fastlane -NV
# Alternatively using Homebrew
brew cask install fastlane
二、初始化
1. cd [工程目录]
- fastlane init
3.What would you like to use fastlane for?
选3
后面按提示输入信息即可
三、安装蒲公英插件
fastlane add_plugin pgyer
四、修改fastlane配置
首先,进入工程目录,并打开 Fastlane 的配置文件(一般在 fastlane/Fastfile),这里我们用 Sublime Text打开。
示例:
# 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: "工程名.xcworkspace", scheme: "****")
upload_to_app_store
end
desc "发布测试版本 到 蒲公英"
lane :beta_pgy do
build_app(workspace: "工程名.xcworkspace", scheme: "****", export_method: "ad-hoc", output_directory: "./fastlane/package", configuration: "Release")
pgyer(api_key: "*******************************", user_key: "*******************************")
end
end
蒲公英api_key、user_key获取地址:https://www.pgyer.com/doc/api
五、打包并上传至蒲公英
bundle exec fastlane beta_pgy
六、常见错误
以上两个错误都为配置信息错误。