简体   繁体   中英

Fastlane - How to get version of podspec

I want to include version of podspec to slack message in fastlane. How to get version of podspec from podfile?

Fastfile file

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 file

pod 'MySDKCore', '1.2.3'

How to get version of podspec from podfile in fastlane?

read the podfile and extract the version with Regular Expressions. we are using Fastlane.swift and doing this like this directly from the .podspec :

func extractVersion(in text: String) throws -> String? {
    return try extract(in: text, with: "version[ ]*=[ ]*\\\"([0-9\\.]*[a-zA-Z-]*)\\\"")
}

the parameters text is the content of the .podspec file. our version format is something like 1.1.1-subproject-name

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM