Skip to content

Commit 0425644

Browse files
committed
Add improvements based on PR comments
1 parent 58d1b17 commit 0425644

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

fastlane/Fastfile

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ platform :ios do
184184

185185
# This lane executes the steps planned on code freeze, creating a new release branch from the current trunk
186186
#
187-
# @param [String] version (optional) The version number for the release from the release tool. If not provided, uses the calculated version.
187+
# @param [String] version (optional) The version to use for the new release version to code freeze for.
188+
# Typically auto-provided by ReleasesV2. If nil, computes the new version based on current one.
188189
# @param [Boolean] skip_confirm (default: false) If set, will skip the confirmation prompt before running the rest of the lane
189190
#
190191
# @example Running the lane
@@ -196,29 +197,33 @@ platform :ios do
196197
# Check out the up-to-date default branch, the designated starting point for the code freeze
197198
Fastlane::Helper::GitHelper.checkout_and_pull(DEFAULT_BRANCH)
198199

199-
# Use provided version from release tool, or fall back to calculated version
200-
calculated_version = release_version_next
201-
release_version = version || calculated_version
202-
203-
# Warn if provided version differs from calculated version
204-
if version && version != calculated_version
205-
warning_message = "⚠️ Version mismatch: Release tool version is '#{version}' but calculated version is '#{calculated_version}'. Using '#{version}' from release tool."
200+
# Use provided version from release tool, or fall back to computed version
201+
computed_version = release_version_next
202+
new_version = version || computed_version
203+
204+
# Warn if provided version differs from computed version
205+
if version && version != computed_version
206+
warning_message = <<~WARNING
207+
⚠️ Version mismatch: The explicitly-provided version was '#{version}' while new computed version would have been '#{computed_version}'.
208+
If this is unexpected, you might want to investigate the discrepency.
209+
Continuing with the explicitly-provided verison '#{version}'.
210+
WARNING
206211
UI.important(warning_message)
207212
buildkite_annotate(style: 'warning', context: 'start-code-freeze-version-mismatch', message: warning_message) if is_ci
208213
end
209214

210215
UI.important <<-MESSAGE
211216
212217
Code Freeze:
213-
• New release branch from #{DEFAULT_BRANCH}: release/#{release_version}
218+
• New release branch from #{DEFAULT_BRANCH}: release/#{new_version}
214219
• Current release version and build code: #{release_version_current} (#{build_code_current}).
215-
• New release version and build code: #{release_version} (#{build_code_code_freeze}).
220+
• New release version and build code: #{new_version} (#{build_code_code_freeze}).
216221
217222
MESSAGE
218223
UI.user_error!("Terminating as requested. Don't forget to run the remainder of this automation manually.") unless skip_confirm || UI.confirm('Do you want to continue?')
219224

220225
# Create the release branch
221-
new_release_branch = "release/#{release_version}"
226+
new_release_branch = "release/#{new_version}"
222227
ensure_branch_does_not_exist!(new_release_branch)
223228

224229
UI.message('Creating release branch...')
@@ -234,8 +239,6 @@ platform :ios do
234239
commit_version_bump
235240
UI.success("Done! New Release Version: #{release_version_current}. New Build Code: #{build_code_current}")
236241

237-
new_version = release_version_current
238-
239242
extract_release_notes_for_version(
240243
version: new_version,
241244
release_notes_file_path: RELEASE_NOTES_SOURCE_PATH,

0 commit comments

Comments
 (0)