|
9 | 9 | # |
10 | 10 | lane :code_freeze do |version: nil, skip_confirm: false| |
11 | 11 | ensure_git_status_clean |
| 12 | + |
12 | 13 | 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 | | - # Warn if provided version differs from computed version |
20 | | - if version && version != computed_version |
21 | | - warning_message = <<~WARNING |
22 | | - ⚠️ Version mismatch: The explicitly-provided version was '#{version}' while new computed version would have been '#{computed_version}'. |
23 | | - If this is unexpected, you might want to investigate the discrepency. |
24 | | - Continuing with the explicitly-provided verison '#{version}'. |
25 | | - WARNING |
26 | | - UI.important(warning_message) |
27 | | - buildkite_annotate(style: 'warning', context: 'code-freeze-version-mismatch', message: warning_message) if is_ci |
28 | | - end |
| 14 | + |
| 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 |
29 | 20 |
|
30 | 21 | message = <<-MESSAGE |
31 | 22 |
|
32 | 23 | Code Freeze: |
33 | | - • New release branch from #{DEFAULT_BRANCH}: release/#{new_version} |
34 | | - • Current release version and build code: #{current_release_version} (#{current_build_code}). |
35 | | - • New release version and build code: #{code_freeze_beta_version} (#{next_build_code}). |
| 24 | + • New release branch from #{DEFAULT_BRANCH}: #{release_branch_name} |
36 | 25 |
|
37 | | - 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}). |
38 | 28 |
|
39 | 29 | MESSAGE |
40 | 30 |
|
41 | 31 | UI.important(message) |
42 | 32 |
|
43 | 33 | UI.user_error!('Aborted by user request') unless skip_confirm || UI.confirm('Do you want to continue?') |
44 | 34 |
|
45 | | - release_branch_name = "release/#{new_version}" |
46 | 35 | ensure_branch_does_not_exist!(release_branch_name) |
47 | 36 |
|
48 | 37 | # Create the release branch |
|
54 | 43 | # Bump the version and build code |
55 | 44 | UI.message 'Bumping beta version and build code...' |
56 | 45 | VERSION_FILE.write_version( |
57 | | - version_name: code_freeze_beta_version, |
58 | | - version_code: next_build_code |
| 46 | + version_name: new_beta_version, |
| 47 | + version_code: new_build_code |
59 | 48 | ) |
60 | 49 | commit_version_bump |
61 | 50 | UI.success "Done! New Beta Version: #{current_beta_version}. New Build Code: #{current_build_code}" |
|
87 | 76 | copy_branch_protection( |
88 | 77 | repository: GITHUB_REPO, |
89 | 78 | from_branch: DEFAULT_BRANCH, |
90 | | - to_branch: "release/#{new_version}" |
| 79 | + to_branch: release_branch_name |
91 | 80 | ) |
92 | 81 |
|
93 | 82 | begin |
|
0 commit comments