Skip to content

Commit ecb21de

Browse files
authored
Merge branch 'trunk' into feat/CMM-933-dont-allow-to-reply-support-closed-tickets
2 parents eb0c9ec + a18c70b commit ecb21de

File tree

2 files changed

+21
-44
lines changed

2 files changed

+21
-44
lines changed

fastlane/Fastfile

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -108,28 +108,16 @@ def current_beta_version
108108
VERSION_FORMATTER.beta_version(current_version)
109109
end
110110

111-
# Returns the beta version that is used by the code freeze
112-
# It first increments the minor number, which also resets the build number to 0
113-
# It then bumps the build number so the -rc-1 can be appended to the code freeze version
114-
def code_freeze_beta_version
115-
# Read the current release version from the .xcconfig file and parse it into an AppVersion object
116-
current_version = VERSION_FORMATTER.parse(VERSION_FILE.read_version_name)
117-
# Calculate the next major version number
118-
next_version = VERSION_CALCULATOR.next_release_version(version: current_version)
119-
# Calculate the next build number
120-
code_freeze_beta_version = VERSION_CALCULATOR.next_build_number(version: next_version)
121-
# Return the formatted release version
122-
VERSION_FORMATTER.beta_version(code_freeze_beta_version)
123-
end
124-
125-
# Returns the beta version of the app in the format `1.2-rc-1`
111+
# Returns the next beta version in the format `1.2-rc-2` (increments the build number)
126112
#
127-
def next_beta_version
128-
# Read the current release version from the .xcconfig file and parse it into an AppVersion object
129-
current_version = VERSION_FORMATTER.parse(VERSION_FILE.read_version_name)
130-
# Calculate the next beta version
113+
def next_beta_version(version_name: nil)
114+
# Use provided version or read the current version from version.properties
115+
version_name ||= VERSION_FILE.read_version_name
116+
# Parse the version string (e.g., "1.2-rc-1") into an AppVersion object
117+
current_version = VERSION_FORMATTER.parse(version_name)
118+
# Increment the build number to get the next beta version
131119
next_beta_version = VERSION_CALCULATOR.next_build_number(version: current_version)
132-
# Return the formatted release version
120+
# Format as beta version (e.g., "1.2-rc-2")
133121
VERSION_FORMATTER.beta_version(next_beta_version)
134122
end
135123

fastlane/lanes/release.rb

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,40 +9,29 @@
99
#
1010
lane :code_freeze do |version: nil, skip_confirm: false|
1111
ensure_git_status_clean
12+
1213
Fastlane::Helper::GitHelper.checkout_and_pull(DEFAULT_BRANCH)
13-
ensure_git_branch(branch: DEFAULT_BRANCH)
14-
15-
# Use provided version from release tool, or fall back to computed version
16-
computed_version = next_release_version
17-
new_version = version || computed_version
18-
19-
# Warn if provided version differs from computed version
20-
if version && version != computed_version
21-
warning_message = <<~WARNING
22-
⚠️ Version mismatch: The explicitly-provided version was '#{version}' while new computed version would have been '#{computed_version}'.
23-
If this is unexpected, you might want to investigate the discrepency.
24-
Continuing with the explicitly-provided verison '#{version}'.
25-
WARNING
26-
UI.important(warning_message)
27-
buildkite_annotate(style: 'warning', context: 'code-freeze-version-mismatch', message: warning_message) if is_ci
28-
end
14+
15+
# If a new version is passed, use it as source of truth from now on
16+
new_version = version || next_release_version
17+
release_branch_name = "release/#{new_version}"
18+
new_beta_version = next_beta_version(version_name: new_version)
19+
new_build_code = next_build_code
2920

3021
message = <<-MESSAGE
3122
3223
Code Freeze:
33-
• New release branch from #{DEFAULT_BRANCH}: release/#{new_version}
34-
• Current release version and build code: #{current_release_version} (#{current_build_code}).
35-
• New release version and build code: #{code_freeze_beta_version} (#{next_build_code}).
24+
• New release branch from #{DEFAULT_BRANCH}: #{release_branch_name}
3625
37-
Do you want to continue?
26+
• Current release version and build code: #{current_release_version} (#{current_build_code}).
27+
• New release version and build code: #{new_beta_version} (#{new_build_code}).
3828
3929
MESSAGE
4030

4131
UI.important(message)
4232

4333
UI.user_error!('Aborted by user request') unless skip_confirm || UI.confirm('Do you want to continue?')
4434

45-
release_branch_name = "release/#{new_version}"
4635
ensure_branch_does_not_exist!(release_branch_name)
4736

4837
# Create the release branch
@@ -54,8 +43,8 @@
5443
# Bump the version and build code
5544
UI.message 'Bumping beta version and build code...'
5645
VERSION_FILE.write_version(
57-
version_name: code_freeze_beta_version,
58-
version_code: next_build_code
46+
version_name: new_beta_version,
47+
version_code: new_build_code
5948
)
6049
commit_version_bump
6150
UI.success "Done! New Beta Version: #{current_beta_version}. New Build Code: #{current_build_code}"
@@ -87,7 +76,7 @@
8776
copy_branch_protection(
8877
repository: GITHUB_REPO,
8978
from_branch: DEFAULT_BRANCH,
90-
to_branch: "release/#{new_version}"
79+
to_branch: release_branch_name
9180
)
9281

9382
begin

0 commit comments

Comments
 (0)