扩展 fastlane 版本管理操作。允许在不使用 agvtool 的情况下设置/获取版本,并执行一些其他小技巧。
扩展 fastlane 版本管理操作。允许在不使用 agvtool 的情况下设置/获取版本,并执行一些其他小技巧。
fastlane PluginThis project is a fastlane plugin. To get started with fastlane-plugin-versioning, add it to your project by running:
fastlane add_plugin versioningExtends fastlane versioning actions. Allows to set/get versions without using agvtool and do some other small tricks.
Note that all schemes that you pass to actions like increment_version_number_in_plist, increment_build_number_in_xcodeproj or get_info_plist_path in scheme parameter must be shared.
To make your scheme shared go to "Manage schemes" in Xcode and tick "Shared" checkbox near your scheme.
plist_build_setting_support stuff about?!If you have a xcodeproject and have updated to Xcode 11, you'll notice that if you change your build and version numbers through the UI, the actual numbers are now stored inside build settings inside build configuration. The Info.plist file -- where they used to be stored -- now contains build setting variables (looks like $(CURRENT_PROJECT_VERSION) or $(MARKETING_VERSION), for build number and version number respectively).
If you are at this migration 'turning point', you have two options. you can either:
plist_build_setting_support: true to your plist action parametersOR
increment_version_number_in_xcodeproj or increment_build_number_in_xcodeproj these also apply to the getters of build and version numbers.Verify your plist files are using the build variables (new) $(CURRENT_PROJECT_VERSION) or $(MARKETING_VERSION). You can force this migration by simply modifying Version/Build fields for each one of your targets in UI. If you forget to make this change, or something else is writing and replacing it, xcodeproj actions will successfully update, but your build will have no reference to those values essentially becoming NOOP
We will leave the plist actions in, as for those consumers who are limited to their upgrade path.
Increment/set the version number in a Info.plist of specific target. Doesn't use agvtool (unlike default increment_version_number).
…get_version_number_from_plist supports the plist_build_setting_support flag, and will either use the other parameters you pass to resolve a particular build configuration to edit, OR change ALL of them.
Get the version number from an Info.plist of specific target. Doesn't use agvtool (unlike default get_version_number).
…get_version_number_from_plist supports the plist_build_setting_support flag, and will either use the other parameters you pass to resolve a particular build configuration to retrieve, OR pick the first it finds.
…# Extracts version number from git branch name.
# `pattern` is pattern by which version number will be found, `#` is place where action must find version number.
# Default value is 'release-#'(for instance for branch name 'releases/release-1.5.0' will extract '1.5.0')
version = get_version_number_from_git_branch(pattern: 'release-#')Increment/set build number in Info.plist of specific target. Doesn't use agvtool (unlike default increment_version_number).
increment_build_number_in_plist # Automatically increments the last part of the build number.
increment_build_number_in_plist(
build_number: 42 # set build number to 42
)increment_build_number_in_plist supports the plist_build_setting_support flag, and will either use the other parameters you pass to resolve a particular build configuration to edit, OR change ALL of them.
Get the build number from an Info.plist of specific target. Doesn't use agvtool (unlike default get_build_number).
…get_build_number_from_plist supports the plist_build_setting_support flag, and will either use the other parameters you pass to resolve a particular build configuration to retrieve, OR pick the first it finds.
Increment/set build number in a xcodeproj of specific target. Doesn't use agvtool (unlike default increment_build_number).
increment_build_number_in_xcodeproj # Automatically increments the last part of the build number.
increment_build_number_in_xcodeproj(
build_number: 42 # set build number to 42
)Get the build number from a xcodeproj - specific to a target. Doesn't use agvtool (unlike default get_build_number).
version = get_build_number_from_xcodeproj(xcodeproj: "Project.xcodeproj", # optional
target: 'TestTarget', # optional, or `scheme`
build_configuration_name: 'Release') # optional, must be specified if you have different Info.plist build settings for different build configurationsIncrement/set the version number in a xcodeproj of specific target. Doesn't use agvtool (unlike default increment_version_number).
…Get the version number from a xcodeproj - specific to a target. Doesn't use agvtool (unlike default get_build_number).
version = get_version_number_from_xcodeproj(xcodeproj: 'Project.xcodeproj', # optional
target: 'TestTarget', # optional, or `scheme`
# optional, must be specified if you have different Info.plist build settings
# for different build configurations
build_configuration_name: 'Release')Get a path to target's Info.plist
get_info_plist_path(xcodeproj: 'Test.xcodeproj', # optional
target: 'TestTarget', # optional, or `scheme`
# optional, must be specified if you have different Info.plist build settings
# for different build configurations
build_configuration_name: 'Release')Get CI system build number. Determined using environment variables defined by CI systems. Supports Jenkins, Travis CI, Circle CI, TeamCity, GoCD, Bamboo, Gitlab CI, Xcode Server, Bitbucket Pipelines, BuddyBuild, AppVeyor. Returns 1 if build number cannot be determined.
increment_build_number_in_plist(
build_number: ci_build_number
)SwiftPM can be tedious when using this plugin, at least in terms of git history and xcodeprojs. Up until recently, there were a number of annoyances caused by this plugin (and a downstream dependency of it) because writing to a project file would clobber some of the comment metadata inside of the project file and replace them - leaving you with the actual version change, but a number of other, less desirable changes too to hand pick through (or give up this plugin for). The advice is, update to >= 0.4.6 of this plugin, and follow this advice - which is to make sure not to include the .git at the end of your SwiftPM dependency URLs.
Note that you will need to set the build and version numbers through Xcode's UI at least once to use this plugin without weird nil:NilClass issues. See this issue for context
For any other issues and feedback about this plugin, please submit it to this repository.
For some more detailed help with plugins problems, check out the Plugins Troubleshooting doc in the main fastlane repo.
fastlane PluginsFor more information about how the fastlane plugin system works, check out the Plugins documentation in the main fastlane repo.
fastlanefastlane automates building, testing, and releasing your app for beta and app store distributions. To learn more about fastlane, check out fastlane.tools.
暂无开放 Issues,或尚未同步最近议题。