我想在快车道中加入Podspec版本以松弛消息。如何从podfile获取podspec的版本?
Fastfile文件
version = get_version_number_from_plist(scheme:ENV['TEST_SCHEME_NAME'])
build_number = get_build_number_from_plist(scheme:ENV['TEST_SCHEME_NAME'])
core_version = ??? -> version of MySDKCore
slack(message: "Released #{version}_#{build_number} app with #{core_version} core version")
[Podfile文件
pod 'MySDKCore', '1.2.3'
如何从Fastlane的podfile中获取podspec的版本?
读取podfile并使用正则表达式提取版本。我们正在使用Fastlane.swift并直接从.podspec
进行此操作:
func extractVersion(in text: String) throws -> String? {
return try extract(in: text, with: "version[ ]*=[ ]*\\\"([0-9\\.]*[a-zA-Z-]*)\\\"")
}
参数text
是.podspec
文件的内容。我们的版本格式类似于1.1.1-subproject-name