Skip to content

Commit 2203244

Browse files
committed
Add improvements based on PR comments
1 parent dea144f commit 2203244

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

fastlane/lanes/release.rb

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
platform :android do
66
# Creates a new release branch from the current default branch
77
#
8-
# @param [String] version (optional) The version number for the release from the release tool. If not provided, uses the calculated version.
8+
# @param [String] version (optional) The version to use for the new release version to code freeze for.
9+
# Typically auto-provided by ReleasesV2. If nil, computes the new version based on current one.
910
# @param [Boolean] skip_prechecks (default: false) If set, will skip prechecks
1011
# @param [Boolean] skip_confirm (default: false) If set, will skip the confirmation prompt
1112
#
@@ -15,16 +16,20 @@
1516
Fastlane::Helper::GitHelper.checkout_and_pull(DEFAULT_BRANCH)
1617

1718
new_version_with_beta = release_version_for_code_freeze
18-
calculated_version = release_version_next
19+
computed_version = release_version_next
1920
new_build_code = build_code_next
2021

21-
# Use provided version from release tool, or fall back to calculated version
22-
release_version = version || calculated_version
23-
computed_release_branch_name = release_branch_name(release_version: release_version)
24-
25-
# Warn if provided version differs from calculated version
26-
if version && version != calculated_version
27-
warning_message = "⚠️ Version mismatch: Release tool version is '#{version}' but calculated version is '#{calculated_version}'. Using '#{version}' from release tool."
22+
# Use provided version from release tool, or fall back to computed version
23+
new_version = version || computed_version
24+
computed_release_branch_name = release_branch_name(release_version: new_version)
25+
26+
# Warn if provided version differs from computed version
27+
if version && version != computed_version
28+
warning_message = <<~WARNING
29+
⚠️ Version mismatch: The explicitly-provided version was '#{version}' while new computed version would have been '#{computed_version}'.
30+
If this is unexpected, you might want to investigate the discrepency.
31+
Continuing with the explicitly-provided verison '#{version}'.
32+
WARNING
2833
UI.important(warning_message)
2934
buildkite_annotate(style: 'warning', context: 'start-code-freeze-version-mismatch', message: warning_message) if is_ci
3035
end
@@ -52,8 +57,6 @@
5257
version_code: new_build_code
5358
)
5459
commit_version_bump
55-
56-
new_version = release_version_current
5760
UI.success("Done! New beta version: #{new_version}. New build code: #{build_code_current}.")
5861

5962
extract_release_notes_for_version(

0 commit comments

Comments
 (0)