Fastlane-如何获取podspec的版本

问题描述 投票:1回答:1

我想在快车道中加入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的版本?

ios cocoapods fastlane
1个回答
0
投票

读取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

© www.soinside.com 2019 - 2024. All rights reserved.