fastlane-plugin-wpmreleasetoolkit 11.0.3 → 12.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_create_xml_release_notes.rb +0 -2
  3. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_current_branch_is_hotfix.rb +1 -9
  4. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/close_milestone_action.rb +0 -2
  5. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/{create_release_action.rb → create_github_release_action.rb} +1 -3
  6. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_new_milestone_action.rb +0 -1
  7. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_release_backmerge_pull_request_action.rb +218 -0
  8. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/publish_github_release_action.rb +63 -0
  9. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_check_beta_deps.rb +0 -3
  10. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_version_helper.rb +2 -373
  11. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/git_helper.rb +27 -22
  12. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/github_helper.rb +26 -1
  13. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_version_helper.rb +0 -270
  14. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata/release_note_short_metadata_block.rb +2 -2
  15. data/lib/fastlane/plugin/wpmreleasetoolkit/version.rb +1 -1
  16. metadata +9 -58
  17. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_betabuild_prechecks.rb +0 -137
  18. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_build_prechecks.rb +0 -108
  19. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_beta.rb +0 -90
  20. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_final_release.rb +0 -82
  21. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_hotfix.rb +0 -91
  22. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_release.rb +0 -109
  23. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_codefreeze_prechecks.rb +0 -108
  24. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_completecodefreeze_prechecks.rb +0 -86
  25. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_finalize_prechecks.rb +0 -89
  26. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_alpha_version.rb +0 -62
  27. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_app_version.rb +0 -62
  28. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_release_version.rb +0 -62
  29. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_hotfix_prechecks.rb +0 -78
  30. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_tag_build.rb +0 -70
  31. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_betabuild_prechecks.rb +0 -98
  32. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_build_prechecks.rb +0 -74
  33. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_beta.rb +0 -67
  34. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_hotfix.rb +0 -83
  35. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_release.rb +0 -87
  36. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_codefreeze_prechecks.rb +0 -76
  37. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_completecodefreeze_prechecks.rb +0 -65
  38. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_current_branch_is_hotfix.rb +0 -40
  39. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_finalize_prechecks.rb +0 -66
  40. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_app_version.rb +0 -54
  41. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_build_number.rb +0 -54
  42. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_build_version.rb +0 -60
  43. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_hotfix_prechecks.rb +0 -78
  44. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_tag_build.rb +0 -44
  45. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_validate_ci_build.rb +0 -46
  46. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_git_helper.rb +0 -28
  47. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_git_helper.rb +0 -28
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7eae107cbe0b856fbe2c3292db7b84bc7ba57ec98da3717e7872243923e63b1d
4
- data.tar.gz: 9576cd4c24122685ab6447fcdd64a2751e44fc36b368b9b22b623e5fe34353c4
3
+ metadata.gz: 2f4bad14f2aca7e44fede245ed91674426c688395c9d6a5085a4d25a5e30e361
4
+ data.tar.gz: 66e0440a5340b12dff4a5e35c37759c48d04c8f157e83e4c57ca94cde2c4135e
5
5
  SHA512:
6
- metadata.gz: c2f85f419598ad21a97f91767bd264303cd4ce47514f61648bceb482214fbab0dc379704aa15dc9d189743ff31220c6e9c61b283826c453ab088594f3886fa3f
7
- data.tar.gz: 4486133931d4c775ff8ec0a084bce9eba9309cebf85f06f9e9aa3182a5974b34d07cb598b48fc30834fb09f8e23a40c0d98aa0c08cc12d982ddea468f4a93c1a
6
+ metadata.gz: 1ed67cfa98a54dfe351d5e90ac318f97f1d40d777ac498f427b7c417f32651f16574eb441de44730ef5a7299edef57b096137b06ab64a4964aca56d072e7a0c0
7
+ data.tar.gz: a698dc1828a99415b4b88b373541ad20b264933cb2d13b0c65b2efd6c4608361b40bb0dca4756f9a518dee3a9e7fa4f8c43e142dfb3a50bba391398f76744bd5
@@ -2,8 +2,6 @@ module Fastlane
2
2
  module Actions
3
3
  class AndroidCreateXmlReleaseNotesAction < Action
4
4
  def self.run(params)
5
- require_relative '../../helper/android/android_git_helper'
6
-
7
5
  release_notes_path = "#{params[:download_path]}/release_notes.xml"
8
6
  open(release_notes_path, 'w') do |f|
9
7
  params[:locales].each do |loc|
@@ -8,11 +8,9 @@ module Fastlane
8
8
  def self.run(params)
9
9
  require_relative '../../helper/android/android_version_helper'
10
10
 
11
- build_gradle_path = params[:build_gradle_path]
12
11
  version_properties_path = params[:version_properties_path]
13
12
 
14
13
  version = Fastlane::Helper::Android::VersionHelper.get_release_version(
15
- build_gradle_path: build_gradle_path,
16
14
  version_properties_path: version_properties_path
17
15
  )
18
16
  Fastlane::Helper::Android::VersionHelper.is_hotfix?(version)
@@ -32,16 +30,10 @@ module Fastlane
32
30
 
33
31
  def self.available_options
34
32
  [
35
- FastlaneCore::ConfigItem.new(key: :build_gradle_path,
36
- description: 'Path to the build.gradle file',
37
- type: String,
38
- optional: true,
39
- conflicting_options: [:version_properties_path]),
40
33
  FastlaneCore::ConfigItem.new(key: :version_properties_path,
41
34
  description: 'Path to the version.properties file',
42
35
  type: String,
43
- optional: true,
44
- conflicting_options: [:build_gradle_path]),
36
+ optional: false),
45
37
  ]
46
38
  end
47
39
 
@@ -1,8 +1,6 @@
1
1
  require 'fastlane/action'
2
2
  require 'date'
3
3
  require_relative '../../helper/github_helper'
4
- require_relative '../../helper/ios/ios_version_helper'
5
- require_relative '../../helper/android/android_version_helper'
6
4
  module Fastlane
7
5
  module Actions
8
6
  class CloseMilestoneAction < Action
@@ -1,11 +1,9 @@
1
1
  require 'fastlane/action'
2
2
  require 'date'
3
3
  require_relative '../../helper/github_helper'
4
- require_relative '../../helper/ios/ios_version_helper'
5
- require_relative '../../helper/android/android_version_helper'
6
4
  module Fastlane
7
5
  module Actions
8
- class CreateReleaseAction < Action
6
+ class CreateGithubReleaseAction < Action
9
7
  def self.run(params)
10
8
  repository = params[:repository]
11
9
  version = params[:version]
@@ -2,7 +2,6 @@ require 'fastlane/action'
2
2
  require 'date'
3
3
  require_relative '../../helper/github_helper'
4
4
  require_relative '../../helper/ios/ios_version_helper'
5
- require_relative '../../helper/android/android_version_helper'
6
5
  module Fastlane
7
6
  module Actions
8
7
  class CreateNewMilestoneAction < Action
@@ -0,0 +1,218 @@
1
+ require 'fastlane/action'
2
+ require_relative '../../helper/github_helper'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ class CreateReleaseBackmergePullRequestAction < Action
7
+ DEFAULT_BRANCH = 'trunk'.freeze
8
+
9
+ def self.run(params)
10
+ token = params[:github_token]
11
+ repository = params[:repository]
12
+ source_branch = params[:source_branch]
13
+ default_branch = params[:default_branch]
14
+ target_branches = params[:target_branches]
15
+ labels = params[:labels]
16
+ milestone_title = params[:milestone_title]
17
+ reviewers = params[:reviewers]
18
+ team_reviewers = params[:team_reviewers]
19
+ intermediate_branch_created_callback = params[:intermediate_branch_created_callback]
20
+
21
+ if target_branches.include?(source_branch)
22
+ UI.user_error!('`target_branches` must not contain `source_branch`')
23
+ end
24
+
25
+ github_helper = Fastlane::Helper::GithubHelper.new(github_token: params[:github_token])
26
+ target_milestone = milestone_title.nil? ? nil : github_helper.get_milestone(repository, milestone_title)
27
+
28
+ final_target_branches = if target_branches.empty?
29
+ unless source_branch.start_with?('release/')
30
+ UI.user_error!('`source_branch` must start with `release/`')
31
+ end
32
+
33
+ determine_target_branches(source_release_version: source_branch.delete('release/'), default_branch: default_branch)
34
+ else
35
+ target_branches
36
+ end
37
+
38
+ final_target_branches.map do |target_branch|
39
+ Fastlane::Helper::GitHelper.checkout_and_pull(source_branch)
40
+
41
+ create_backmerge_pr(
42
+ token: token,
43
+ repository: repository,
44
+ title: "Merge #{source_branch} into #{target_branch}",
45
+ head_branch: source_branch,
46
+ base_branch: target_branch,
47
+ labels: labels,
48
+ milestone: target_milestone&.number,
49
+ reviewers: reviewers,
50
+ team_reviewers: team_reviewers,
51
+ intermediate_branch_created_callback: intermediate_branch_created_callback
52
+ )
53
+ end.compact
54
+ end
55
+
56
+ # Determines the target branches for a release version.
57
+ #
58
+ # @param source_release_version [String] the source release version to compare against other release branches.
59
+ # @param default_branch [String] the default branch to use if no target branches are found.
60
+ # @return [Array<String>] the list of target branches greater than the release version.
61
+ def self.determine_target_branches(source_release_version:, default_branch:)
62
+ release_branches = Actions.sh('git', 'branch', '-r', '-l', 'origin/release/*').strip.split("\n")
63
+
64
+ all_release_branches_versions = release_branches
65
+ .map { |branch| branch.match(%r{origin/release/([0-9.]*)})&.captures&.first }
66
+ .compact
67
+
68
+ target_branches = all_release_branches_versions.select { |branch| Gem::Version.new(branch) > Gem::Version.new(source_release_version) }
69
+ .map { |v| "release/#{v}" }
70
+ target_branches = [default_branch] if target_branches.empty?
71
+
72
+ target_branches
73
+ end
74
+
75
+ # Creates a backmerge pull request using the `create_pull_request` Fastlane Action.
76
+ #
77
+ # @param token [String] the GitHub token for authentication.
78
+ # @param repository [String] the repository where the pull request will be created.
79
+ # @param title [String] the title of the pull request.
80
+ # @param head_branch [String] the source branch for the pull request.
81
+ # @param base_branch [String] the target branch for the pull request.
82
+ # @param labels [Array<String>] the labels to add to the pull request.
83
+ # @param milestone [String] the milestone to associate with the pull request.
84
+ # @param reviewers [Array<String>] the individual reviewers for the pull request.
85
+ # @param team_reviewers [Array<String>] the team reviewers for the pull request.
86
+ # @param intermediate_branch_created_callback [Proc] A callback to call after having created the intermediate branch
87
+ # to allow the caller to e.g. add new commits on it before the PR is created. The callback takes two parameters: the base branch and the intermediate branch
88
+ #
89
+ # @return [String] The URL of the created Pull Request, or `nil` if no PR was created.
90
+ #
91
+ def self.create_backmerge_pr(token:, repository:, title:, head_branch:, base_branch:, labels:, milestone:, reviewers:, team_reviewers:, intermediate_branch_created_callback:)
92
+ intermediate_branch = "merge/#{head_branch.gsub('/', '-')}-into-#{base_branch.gsub('/', '-')}"
93
+
94
+ if Fastlane::Helper::GitHelper.branch_exists_on_remote?(branch_name: intermediate_branch)
95
+ UI.user_error!("The intermediate branch `#{intermediate_branch}` already exists. Please check if there is an existing Pull Request that needs to be merged or closed first, or delete the branch.")
96
+ return nil
97
+ end
98
+
99
+ Fastlane::Helper::GitHelper.create_branch(intermediate_branch)
100
+
101
+ intermediate_branch_created_callback&.call(base_branch, intermediate_branch)
102
+
103
+ # if there's a callback, make sure it didn't switch branches
104
+ other_action.ensure_git_branch(branch: "^#{intermediate_branch}/") unless intermediate_branch_created_callback.nil?
105
+
106
+ base_branch_ref = base_branch.start_with?('origin/') ? base_branch : "origin/#{base_branch}"
107
+ head_branch_ref = head_branch.start_with?('origin/') ? head_branch : "origin/#{head_branch}"
108
+
109
+ if Fastlane::Helper::GitHelper.point_to_same_commit?(base_branch_ref, head_branch_ref)
110
+ UI.error("No differences between #{head_branch} and #{base_branch}. Skipping PR creation.")
111
+ return nil
112
+ end
113
+
114
+ other_action.push_to_git_remote(tags: false)
115
+
116
+ pr_body = <<~BODY
117
+ Merging `#{head_branch}` into `#{base_branch}`.
118
+
119
+ Via intermediate branch `#{intermediate_branch}`, to help fix conflicts if any:
120
+ ```
121
+ #{head_branch.rjust(40)} ----o-- - - -
122
+ #{' ' * 40} \\
123
+ #{intermediate_branch.rjust(40)} `---.
124
+ #{' ' * 40} \\
125
+ #{base_branch.rjust(40)} ------------x- - -
126
+ ```
127
+ BODY
128
+
129
+ other_action.create_pull_request(
130
+ api_token: token,
131
+ repo: repository,
132
+ title: title,
133
+ body: pr_body,
134
+ head: intermediate_branch,
135
+ base: base_branch,
136
+ labels: labels,
137
+ milestone: milestone,
138
+ reviewers: reviewers,
139
+ team_reviewers: team_reviewers
140
+ )
141
+ end
142
+
143
+ def self.description
144
+ 'Creates backmerge PRs for a release branch into target branches'
145
+ end
146
+
147
+ def self.authors
148
+ ['Automattic']
149
+ end
150
+
151
+ def self.return_type
152
+ :array_of_strings
153
+ end
154
+
155
+ def self.return_value
156
+ 'The list of the created backmerge Pull Request URLs'
157
+ end
158
+
159
+ def self.details
160
+ <<~DETAILS
161
+ This action creates backmerge Pull Requests from a release branch into one or more target branches.
162
+
163
+ It can be used to ensure that changes from a release branch are merged back into other branches, such as newer release branches or the main development branch (e.g., `trunk`).
164
+ DETAILS
165
+ end
166
+
167
+ def self.available_options
168
+ [
169
+ FastlaneCore::ConfigItem.new(key: :repository,
170
+ env_name: 'GHHELPER_REPOSITORY',
171
+ description: 'The remote path of the GH repository on which we work',
172
+ optional: false,
173
+ type: String),
174
+ FastlaneCore::ConfigItem.new(key: :source_branch,
175
+ description: 'The source branch to create a backmerge PR from, in the format `release/x.y.z`',
176
+ optional: false,
177
+ type: String),
178
+ FastlaneCore::ConfigItem.new(key: :default_branch,
179
+ description: 'The default branch to target if no newer release branches exist',
180
+ optional: true,
181
+ default_value: DEFAULT_BRANCH,
182
+ type: String),
183
+ FastlaneCore::ConfigItem.new(key: :target_branches,
184
+ description: 'Array of target branches for the backmerge. If empty, the action will determine target branches by finding all `release/x.y.z` branches with a `x.y.z` version greater than the version in source branch\'s name. If none are found, it will target `default_branch`', # rubocop:disable Layout/LineLength
185
+ optional: true,
186
+ default_value: [],
187
+ type: Array),
188
+ FastlaneCore::ConfigItem.new(key: :labels,
189
+ description: 'The labels that should be assigned to the backmerge PRs',
190
+ optional: true,
191
+ default_value: [],
192
+ type: Array),
193
+ FastlaneCore::ConfigItem.new(key: :milestone_title,
194
+ description: 'The title of the milestone to assign to the created PRs',
195
+ optional: true,
196
+ type: String),
197
+ FastlaneCore::ConfigItem.new(key: :reviewers,
198
+ description: 'An array of GitHub users that will be assigned to the pull request',
199
+ optional: true,
200
+ type: Array),
201
+ FastlaneCore::ConfigItem.new(key: :team_reviewers,
202
+ description: 'An array of GitHub team slugs that will be assigned to the pull request',
203
+ optional: true,
204
+ type: Array),
205
+ FastlaneCore::ConfigItem.new(key: :intermediate_branch_created_callback,
206
+ description: 'Callback to allow for the caller to perform operations on the intermediate branch before pushing. The call back receives two parameters: the base (target) branch for the PR and the intermediate branch name',
207
+ optional: true,
208
+ type: Proc),
209
+ Fastlane::Helper::GithubHelper.github_token_config_item,
210
+ ]
211
+ end
212
+
213
+ def self.is_supported?(platform)
214
+ true
215
+ end
216
+ end
217
+ end
218
+ end
@@ -0,0 +1,63 @@
1
+ require 'fastlane/action'
2
+ require_relative '../../helper/github_helper'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ class PublishGithubReleaseAction < Action
7
+ def self.run(params)
8
+ repository = params[:repository]
9
+ name = params[:name]
10
+ prerelease = params[:prerelease]
11
+
12
+ github_helper = Fastlane::Helper::GithubHelper.new(github_token: params[:github_token])
13
+
14
+ url = github_helper.publish_release(
15
+ repository: repository,
16
+ name: name,
17
+ prerelease: prerelease == :unchanged ? nil : prerelease
18
+ )
19
+ UI.success("Successfully published GitHub Release #{name}. You can see it at '#{url}'")
20
+ url
21
+ end
22
+
23
+ def self.description
24
+ 'Publish an existing GitHub Release still in draft mode'
25
+ end
26
+
27
+ def self.authors
28
+ ['Automattic']
29
+ end
30
+
31
+ def self.return_value
32
+ 'The URL of the published GitHub Release'
33
+ end
34
+
35
+ def self.details
36
+ 'Publish an existing GitHub Release still in draft mode'
37
+ end
38
+
39
+ def self.available_options
40
+ [
41
+ FastlaneCore::ConfigItem.new(key: :repository,
42
+ description: 'The slug (`<org>/<repo>`) of the GitHub repository we want to create the release on',
43
+ optional: false,
44
+ type: String),
45
+ FastlaneCore::ConfigItem.new(key: :name,
46
+ description: 'The name (aka title) of the draft release to publish',
47
+ optional: false,
48
+ type: String),
49
+ FastlaneCore::ConfigItem.new(key: :prerelease,
50
+ description: 'True to publish as a pre-release. False to published as final. Don\'t provide a value to keep the same (non-)prerelease status as the one used in the Draft',
51
+ optional: true,
52
+ default_value: :unchanged,
53
+ type: Boolean),
54
+ Fastlane::Helper::GithubHelper.github_token_config_item,
55
+ ]
56
+ end
57
+
58
+ def self.is_supported?(platform)
59
+ true
60
+ end
61
+ end
62
+ end
63
+ end
@@ -7,9 +7,6 @@ module Fastlane
7
7
  NON_STABLE_PODS_MESSAGE = "Please create a new stable version of those pods and update the Podfile to the newly released version before continuing with the code freeze:\n".freeze
8
8
 
9
9
  def self.run(params)
10
- require_relative '../../helper/ios/ios_version_helper'
11
- require_relative '../../helper/ios/ios_git_helper'
12
-
13
10
  yaml = YAML.load_file(params[:lockfile])
14
11
  non_stable_pods = {} # Key will be pod name, value will be reason for flagging
15
12