簡體   English   中英

Fastlane - 如何獲取 podspec 的版本

[英]Fastlane - How to get version of podspec

我想在 fastlane 中包含 podspec 的版本以松弛消息。 如何從 podfile 獲取 podspec 的版本?

快速文件

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM