|
9 | 9 | # - Extracts the Release Notes |
10 | 10 | # - Freezes the GitHub milestone and enables the GitHub branch protection for the new branch |
11 | 11 | # |
12 | | - # @option [Boolean] skip_confirm (default: false) If true, avoids any interactive prompt |
| 12 | + # @param [Boolean] skip_confirm (default: false) If true, avoids any interactive prompt |
| 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. |
13 | 15 | # |
14 | | - desc 'Executes the initial steps needed during code freeze' |
15 | | - lane :code_freeze do |options| |
| 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 | | - release_branch_name = compute_release_branch_name(options: options, version: release_version_next) |
| 22 | + # Use provided version from release tool, or fall back to computed version |
| 23 | + computed_version = release_version_next |
| 24 | + provided_version = version |
| 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 |
| 34 | + UI.important(warning_message) |
| 35 | + buildkite_annotate(style: 'warning', context: 'code-freeze-version-mismatch', message: warning_message) if is_ci |
| 36 | + end |
| 37 | + |
| 38 | + release_branch_name = compute_release_branch_name(options: { version: version, skip_confirm: skip_confirm }, version: new_version) |
22 | 39 | ensure_branch_does_not_exist!(release_branch_name) |
23 | 40 |
|
24 | 41 | # The `release_version_next` is used as the `new internal release version` value because the external and internal |
|
28 | 45 | • New release branch from #{DEFAULT_BRANCH}: #{release_branch_name} |
29 | 46 |
|
30 | 47 | • Current release version and build code: #{release_version_current} (#{build_code_current}). |
31 | | - • New release version and build code: #{release_version_next} (#{build_code_code_freeze}). |
| 48 | + • New release version and build code: #{new_version} (#{build_code_code_freeze}). |
32 | 49 | MESSAGE |
33 | 50 |
|
34 | 51 | UI.important(message) |
35 | 52 |
|
36 | | - skip_user_confirmation = options[:skip_confirm] |
37 | | - |
38 | | - UI.user_error!('Aborted by user request') unless skip_user_confirmation || UI.confirm('Do you want to continue?') |
| 53 | + UI.user_error!('Aborted by user request') unless skip_confirm || UI.confirm('Do you want to continue?') |
39 | 54 |
|
40 | 55 | UI.message 'Creating release branch...' |
41 | 56 | Fastlane::Helper::GitHelper.create_branch(release_branch_name, from: DEFAULT_BRANCH) |
|
51 | 66 |
|
52 | 67 | commit_version_and_build_files |
53 | 68 |
|
54 | | - new_version = release_version_current |
55 | | - |
56 | 69 | release_notes_source_path = File.join(PROJECT_ROOT_FOLDER, 'RELEASE-NOTES.txt') |
57 | 70 | extract_release_notes_for_version( |
58 | 71 | version: new_version, |
|
0 commit comments