Thx @Philippe, i've made a bash script:
# - RELEASE EBF737881ECAECD400F5A5DF
# - DEBUG EBF737871ECAECD400F5A5DF
currentVersion=$(/usr/libexec/PlistBuddy -c "print :objects:EBF737871ECAECD400F5A5DF:buildSettings:FC_VERSION" ../FormaCar.xcodeproj/project.pbxproj)
newVersion="${currentVersion%.*}.$((${currentVersion##*.}+1))"
/usr/libexec/PlistBuddy -c "set :objects:EBF737871ECAECD400F5A5DF:buildSettings:FC_VERSION $newVersion" ../FormaCar.xcodeproj/project.pbxproj
/usr/libexec/PlistBuddy -c "set :objects:EBF737881ECAECD400F5A5DF:buildSettings:FC_VERSION $newVersion" ../FormaCar.xcodeproj/project.pbxproj
echo "Old version: $currentVersion. Version bumped to: $newVersion"
where FC_VERSION
is user-defined parameter and holds a version in x.x.x
format.
and in Fastfile
lane :bumpMinorVersionNumber do
sh "./bumpMinorVersionNumber.sh"
end
This script bumps the minor version of FC_VERSION setting and works via fastlane
UPDATE:
Unfortunately PlistBuddy format .pbxproj to xml-format plist so source control getting stack and the information is lost. So I can't use this solution(
Thx to https://stackoverflow.com/a/56179405/5790492 and https://nshipster.com/xcconfig/
I've created the xcconfig file, added it to project in Info tab. For fastlane added this plugin to work with xcconfig. And now lane looks like:
currentBuildNumber = get_xcconfig_value(path: 'fastlane/VersionsConfig.xcconfig',
name: 'FC_BUILD')
newBuildNumber = currentBuildNumber.to_i + 1
update_xcconfig_value(path: 'fastlane/VersionsConfig.xcconfig',
name: 'FC_BUILD',
value: newBuildNumber.to_s)
UI.important("Old build number: #{currentBuildNumber}. Build number bumped to: #{newBuildNumber}")
It works like a charm!