|
10 | 10 | # - Freezes the GitHub milestone and enables the GitHub branch protection for the new branch |
11 | 11 | # |
12 | 12 | # @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. |
14 | 15 | # |
15 | 16 | lane :code_freeze do |skip_confirm: false, version: nil| |
16 | 17 | ensure_git_status_clean |
17 | 18 |
|
18 | 19 | # Check out the up-to-date default branch, the designated starting point for the code freeze |
19 | 20 | Fastlane::Helper::GitHelper.checkout_and_pull(DEFAULT_BRANCH) |
20 | 21 |
|
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 |
23 | 24 | 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 |
29 | 34 | UI.important(warning_message) |
30 | 35 | buildkite_annotate(style: 'warning', context: 'code-freeze-version-mismatch', message: warning_message) if is_ci |
31 | 36 | end |
32 | 37 |
|
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) |
34 | 39 | ensure_branch_does_not_exist!(release_branch_name) |
35 | 40 |
|
36 | 41 | # The `release_version_next` is used as the `new internal release version` value because the external and internal |
|
40 | 45 | • New release branch from #{DEFAULT_BRANCH}: #{release_branch_name} |
41 | 46 |
|
42 | 47 | • 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}). |
44 | 49 | MESSAGE |
45 | 50 |
|
46 | 51 | UI.important(message) |
|
61 | 66 |
|
62 | 67 | commit_version_and_build_files |
63 | 68 |
|
64 | | - new_version = release_version_current |
65 | | - |
66 | 69 | release_notes_source_path = File.join(PROJECT_ROOT_FOLDER, 'RELEASE-NOTES.txt') |
67 | 70 | extract_release_notes_for_version( |
68 | 71 | version: new_version, |
|
0 commit comments