|
9 | 9 | # |
10 | 10 | lane :code_freeze do |version: nil, skip_confirm: false| |
11 | 11 | ensure_git_status_clean |
12 | | - Fastlane::Helper::GitHelper.checkout_and_pull(DEFAULT_BRANCH) |
13 | | - ensure_git_branch(branch: DEFAULT_BRANCH) |
14 | | - |
15 | | - # Use provided version from release tool, or fall back to computed version |
16 | | - computed_version = next_release_version |
17 | | - new_version = version || computed_version |
18 | | - |
19 | | - # Fail if provided version differs from computed version |
20 | | - if version && version != computed_version |
21 | | - error_message = <<~ERROR |
22 | | - ❌ Version mismatch detected! |
23 | 12 |
|
24 | | - The explicitly-provided version from the release tool is '#{version}' but the computed version from the codebase is '#{computed_version}'. |
| 13 | + Fastlane::Helper::GitHelper.checkout_and_pull(DEFAULT_BRANCH) |
25 | 14 |
|
26 | | - This mismatch must be resolved before proceeding with the code freeze. Please investigate and ensure the versions are aligned. |
27 | | - ERROR |
28 | | - buildkite_annotate(style: 'error', context: 'code-freeze-version-mismatch', message: error_message) if is_ci |
29 | | - UI.user_error!(error_message) |
30 | | - end |
| 15 | + # If a new version is passed, use it as source of truth from now on |
| 16 | + new_version = version || next_release_version |
| 17 | + release_branch_name = "release/#{new_version}" |
| 18 | + new_beta_version = next_beta_version(version_name: new_version) |
| 19 | + new_build_code = next_build_code |
31 | 20 |
|
32 | 21 | message = <<-MESSAGE |
33 | 22 |
|
34 | 23 | Code Freeze: |
35 | | - • New release branch from #{DEFAULT_BRANCH}: release/#{new_version} |
36 | | - • Current release version and build code: #{current_release_version} (#{current_build_code}). |
37 | | - • New release version and build code: #{code_freeze_beta_version} (#{next_build_code}). |
| 24 | + • New release branch from #{DEFAULT_BRANCH}: #{release_branch_name} |
38 | 25 |
|
39 | | - Do you want to continue? |
| 26 | + • Current release version and build code: #{current_release_version} (#{current_build_code}). |
| 27 | + • New release version and build code: #{new_beta_version} (#{new_build_code}). |
40 | 28 |
|
41 | 29 | MESSAGE |
42 | 30 |
|
43 | 31 | UI.important(message) |
44 | 32 |
|
45 | 33 | UI.user_error!('Aborted by user request') unless skip_confirm || UI.confirm('Do you want to continue?') |
46 | 34 |
|
47 | | - release_branch_name = "release/#{new_version}" |
48 | 35 | ensure_branch_does_not_exist!(release_branch_name) |
49 | 36 |
|
50 | 37 | # Create the release branch |
|
56 | 43 | # Bump the version and build code |
57 | 44 | UI.message 'Bumping beta version and build code...' |
58 | 45 | VERSION_FILE.write_version( |
59 | | - version_name: code_freeze_beta_version, |
60 | | - version_code: next_build_code |
| 46 | + version_name: new_beta_version, |
| 47 | + version_code: new_build_code |
61 | 48 | ) |
62 | 49 | commit_version_bump |
63 | 50 | UI.success "Done! New Beta Version: #{current_beta_version}. New Build Code: #{current_build_code}" |
|
89 | 76 | copy_branch_protection( |
90 | 77 | repository: GITHUB_REPO, |
91 | 78 | from_branch: DEFAULT_BRANCH, |
92 | | - to_branch: "release/#{new_version}" |
| 79 | + to_branch: release_branch_name |
93 | 80 | ) |
94 | 81 |
|
95 | 82 | begin |
|
0 commit comments