Skip to content

Commit 7b2aba1

Browse files
committed
Add improvements based on PR comments
1 parent bf095a6 commit 7b2aba1

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

fastlane/lanes/release.rb

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,32 @@
1010
# - Freezes the GitHub milestone and enables the GitHub branch protection for the new branch
1111
#
1212
# @param [Boolean] skip_confirm (default: false) If true, avoids any interactive prompt
13-
# @param [String] version (optional) The version number for the release from the release tool. If not provided, uses the calculated version.
13+
# @param [String] version (optional) The version to use for the new release version to code freeze for.
14+
# Typically auto-provided by ReleasesV2. If nil, computes the new version based on current one.
1415
#
1516
lane :code_freeze do |skip_confirm: false, version: nil|
1617
ensure_git_status_clean
1718

1819
# Check out the up-to-date default branch, the designated starting point for the code freeze
1920
Fastlane::Helper::GitHelper.checkout_and_pull(DEFAULT_BRANCH)
2021

21-
# Use provided version from release tool, or fall back to calculated version
22-
calculated_version = release_version_next
22+
# Use provided version from release tool, or fall back to computed version
23+
computed_version = release_version_next
2324
provided_version = version
24-
release_version = provided_version || calculated_version
25-
26-
# Warn if provided version differs from calculated version
27-
if provided_version && provided_version != calculated_version
28-
warning_message = "⚠️ Version mismatch: Release tool version is '#{provided_version}' but calculated version is '#{calculated_version}'. Using '#{provided_version}' from release tool."
25+
new_version = provided_version || computed_version
26+
27+
# Warn if provided version differs from computed version
28+
if provided_version && provided_version != computed_version
29+
warning_message = <<~WARNING
30+
⚠️ Version mismatch: The explicitly-provided version was '#{provided_version}' while new computed version would have been '#{computed_version}'.
31+
If this is unexpected, you might want to investigate the discrepency.
32+
Continuing with the explicitly-provided verison '#{provided_version}'.
33+
WARNING
2934
UI.important(warning_message)
3035
buildkite_annotate(style: 'warning', context: 'code-freeze-version-mismatch', message: warning_message) if is_ci
3136
end
3237

33-
release_branch_name = compute_release_branch_name(options: { version: version, skip_confirm: skip_confirm }, version: release_version)
38+
release_branch_name = compute_release_branch_name(options: { version: version, skip_confirm: skip_confirm }, version: new_version)
3439
ensure_branch_does_not_exist!(release_branch_name)
3540

3641
# The `release_version_next` is used as the `new internal release version` value because the external and internal
@@ -40,7 +45,7 @@
4045
• New release branch from #{DEFAULT_BRANCH}: #{release_branch_name}
4146
4247
• Current release version and build code: #{release_version_current} (#{build_code_current}).
43-
• New release version and build code: #{release_version} (#{build_code_code_freeze}).
48+
• New release version and build code: #{new_version} (#{build_code_code_freeze}).
4449
MESSAGE
4550

4651
UI.important(message)
@@ -61,8 +66,6 @@
6166

6267
commit_version_and_build_files
6368

64-
new_version = release_version_current
65-
6669
release_notes_source_path = File.join(PROJECT_ROOT_FOLDER, 'RELEASE-NOTES.txt')
6770
extract_release_notes_for_version(
6871
version: new_version,

0 commit comments

Comments
 (0)