Fastlane calendar versioning check and increase (#3721)

* update fastfile

* original comment

---------

Co-authored-by: Element CI <ci@element.io>
This commit is contained in:
Mauro 2025-01-31 13:34:25 +01:00 committed by GitHub
parent d5fb72c16c
commit 5cffad937e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,5 +1,4 @@
require 'yaml'
require 'semantic'
enterprise = '../Enterprise/fastlane/Fastfile'
if File.exist?(enterprise)
@ -253,14 +252,20 @@ lane :prepare_next_release do
data = YAML.load_file target_file_path
current_version = data["settings"]["MARKETING_VERSION"]
version = Semantic::Version.new(current_version)
new_version = version.increment!(:patch)
# Bump the patch version. The empty string after -i is so that sed doesn't
matches = current_version.match(/^(\d{2})\.(\d{2})\.(\d+)$/)
unless matches
UI.user_error!("Invalid version format: #{current_version}")
end
year, month, build = matches.captures
new_build = build.to_i + 1
new_version = "#{year}.#{month}.#{new_build}"
# Bump the patch version. The empty string after -i is so that sed doesn't
# create a backup file on macOS
sh("sed -i '' 's/MARKETING_VERSION: #{current_version}/MARKETING_VERSION: #{new_version.to_string}/g' #{target_file_path}")
sh("sed -i '' 's/MARKETING_VERSION: #{current_version}/MARKETING_VERSION: #{new_version}/g' #{target_file_path}")
UI.message("Version updated from #{current_version} to #{new_version}")
xcodegen(spec: "project.yml")