fastlane
程序员文章站
2024-03-23 20:41:22
...
1.初始化fastlane
fastlane init
2.在终端中,输入以下命令,即可安装蒲公英的 fastlane 插件。
fastlane add_plugin pgyer
3.修改fastlane文件夹里面的Fastlane
###将********对应替换成自己项目对应的
#测试包命令 (版本描述)
# fastlane develop desc:测试自动发包3.6.0B1
# 网络请求依赖
require 'net/http'
require 'uri'
require 'json'
#蒲公英api_key和user_key
pgyer_api_key = "*****************"
pgyer_user_key = "*****************"
#下载地址
app_url = "*****************"
app_icon = "*****************"
#钉钉
DingTalkUrl = "*****************"
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 :develop do |options|
gym(
#输出的ipa名称
output_name:”*****************”,
# 是否清空以前的编译信息 true:是
clean:true,
# 指定打包方式,Release 或者 Debug
configuration:"Debug",
# 指定打包所使用的输出方式,目前支持app-store, package, ad-hoc, enterprise, development
export_method:"development",
# 指定输出文件夹
output_directory:"./fastlane/development",
)
puts "开始上传蒲公英"
pgyer(api_key: “#{pgyer_api_key}”,
user_key: “#{pgyer_user_key}”,
password: "123", install_type: "2",
update_description: options[:desc]
)
puts '开始钉钉'
app_patch = "./fastlane/development/*****************.ipa"
app_version = get_ipa_info_plist_value(ipa: app_patch, key: "CFBundleShortVersionString")
app_build_version = get_ipa_info_plist_value(ipa: app_patch, key: "CFBundleVersion")
app_name = get_ipa_info_plist_value(ipa: app_patch, key: "CFBundleDisplayName")
dingTalk_url = DingTalkUrl
markdown =
{
msgtype: "link",
link: {
text: {
各位小姐姐、小哥哥 最新版本已发布,辛苦测试",
title: "iOS #{app_name} #{app_version} (#{app_build_version}) 内测版",
picUrl: "#{app_icon}",
messageUrl: "#{app_url}"
}
}
uri = URI.parse(dingTalk_url)
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
request = Net::HTTP::Post.new(uri.request_uri)
request.add_field('Content-Type', 'application/json')
request.body = markdown.to_json
response = https.request(request)
puts "------------------------------"
puts "Response #{response.code} #{response.message}: #{response.body}"
end
end
上一篇: mysql 连表分组 多个字段用逗号隔开
下一篇: mac上安装Nginx详细教程