fastlane-plugin-wpmreleasetoolkit 13.0.0 → 13.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_release_backmerge_pull_request_action.rb +65 -46
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/prototype_build_details_comment_action.rb +6 -3
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb +4 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/buildkite_aware_log_groups.rb +45 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_adc_app_sizes_helper.rb +2 -2
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_strings_file_validation_helper.rb +2 -2
- data/lib/fastlane/plugin/wpmreleasetoolkit/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 812b207092ef802b165390e74ba296566e70a3e406c7e1a50572a6bd7b6da761
|
4
|
+
data.tar.gz: 9266eec38e720af58e54413e649b2451e0f88100f4621bfab25daa05912663ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45a5b7aceb10ac90eaf7bf81e3c8cf07d1ed67691d558c610d8393db098e699f20f8ed63dcaf97f3af44f70433ee70f278ac0ee7185a1374642c4b4504ac51df
|
7
|
+
data.tar.gz: 8a8f7296d5458082034650d8675a17e4144f3d9c5cfc45e7482101c69ab1cdcadc645109b5151a65099167b0b910b5b4f092e92f717dcd210e37c9d5e7780e3a
|
@@ -9,6 +9,7 @@ module Fastlane
|
|
9
9
|
DEFAULT_BRANCH = 'trunk'
|
10
10
|
|
11
11
|
def self.run(params)
|
12
|
+
api_url = params[:api_url]
|
12
13
|
token = params[:github_token]
|
13
14
|
repository = params[:repository]
|
14
15
|
source_branch = params[:source_branch]
|
@@ -41,6 +42,7 @@ module Fastlane
|
|
41
42
|
Fastlane::Helper::GitHelper.checkout_and_pull(source_branch)
|
42
43
|
|
43
44
|
create_backmerge_pr(
|
45
|
+
api_url: api_url,
|
44
46
|
token: token,
|
45
47
|
repository: repository,
|
46
48
|
title: "Merge #{source_branch} into #{target_branch}",
|
@@ -76,6 +78,7 @@ module Fastlane
|
|
76
78
|
|
77
79
|
# Creates a backmerge pull request using the `create_pull_request` Fastlane Action.
|
78
80
|
#
|
81
|
+
# @param api_url [String] the GitHub API URL to use for creating the pull request
|
79
82
|
# @param token [String] the GitHub token for authentication.
|
80
83
|
# @param repository [String] the repository where the pull request will be created.
|
81
84
|
# @param title [String] the title of the pull request.
|
@@ -90,7 +93,7 @@ module Fastlane
|
|
90
93
|
#
|
91
94
|
# @return [String] The URL of the created Pull Request, or `nil` if no PR was created.
|
92
95
|
#
|
93
|
-
def self.create_backmerge_pr(token:, repository:, title:, head_branch:, base_branch:, labels:, milestone:, reviewers:, team_reviewers:, intermediate_branch_created_callback:)
|
96
|
+
def self.create_backmerge_pr(api_url:, token:, repository:, title:, head_branch:, base_branch:, labels:, milestone:, reviewers:, team_reviewers:, intermediate_branch_created_callback:) # rubocop:disable Metrics/ParameterLists
|
94
97
|
# Do an early pre-check to see if the PR would be valid, but only if no callback (as a callback might add new commits on intermediate branch)
|
95
98
|
if intermediate_branch_created_callback.nil? && !can_merge?(head_branch, into: base_branch)
|
96
99
|
UI.error("Nothing to merge from #{head_branch} into #{base_branch}. Skipping PR creation.")
|
@@ -108,7 +111,9 @@ module Fastlane
|
|
108
111
|
|
109
112
|
# Call the callback if one was provided to allow the use to add commits on the intermediate branch (e.g. solve conflicts)
|
110
113
|
unless intermediate_branch_created_callback.nil?
|
111
|
-
|
114
|
+
Dir.chdir(FastlaneCore::FastlaneFolder.path) do
|
115
|
+
intermediate_branch_created_callback.call(base_branch, intermediate_branch)
|
116
|
+
end
|
112
117
|
# Make sure the callback block didn't switch branches
|
113
118
|
other_action.ensure_git_branch(branch: "^#{intermediate_branch}$")
|
114
119
|
|
@@ -120,7 +125,7 @@ module Fastlane
|
|
120
125
|
end
|
121
126
|
end
|
122
127
|
|
123
|
-
other_action.push_to_git_remote(tags: false)
|
128
|
+
other_action.push_to_git_remote(tags: false, remote_branch: intermediate_branch, set_upstream: true)
|
124
129
|
|
125
130
|
pr_body = <<~BODY
|
126
131
|
Merging `#{head_branch}` into `#{base_branch}`.
|
@@ -136,6 +141,7 @@ module Fastlane
|
|
136
141
|
BODY
|
137
142
|
|
138
143
|
other_action.create_pull_request(
|
144
|
+
api_url: api_url,
|
139
145
|
api_token: token,
|
140
146
|
repo: repository,
|
141
147
|
title: title,
|
@@ -191,50 +197,63 @@ module Fastlane
|
|
191
197
|
end
|
192
198
|
|
193
199
|
def self.available_options
|
200
|
+
# Parameters we want to forward from Fastlane's create_pull_request action
|
201
|
+
forwarded_param_keys = %i[
|
202
|
+
api_url
|
203
|
+
labels
|
204
|
+
assignees
|
205
|
+
reviewers
|
206
|
+
team_reviewers
|
207
|
+
].freeze
|
208
|
+
|
209
|
+
forwarded_params = Fastlane::Actions::CreatePullRequestAction.available_options.select do |opt|
|
210
|
+
forwarded_param_keys.include?(opt.key)
|
211
|
+
end
|
212
|
+
|
194
213
|
[
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
FastlaneCore::ConfigItem.new(
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
214
|
+
*forwarded_params,
|
215
|
+
Fastlane::Helper::GithubHelper.github_token_config_item, # we forward `github_token` to `api_token` in the `create_pull_request` action
|
216
|
+
FastlaneCore::ConfigItem.new(
|
217
|
+
key: :repository,
|
218
|
+
env_name: 'GHHELPER_REPOSITORY',
|
219
|
+
description: 'The remote path of the GH repository on which we work',
|
220
|
+
optional: false,
|
221
|
+
type: String
|
222
|
+
),
|
223
|
+
FastlaneCore::ConfigItem.new(
|
224
|
+
key: :source_branch,
|
225
|
+
description: 'The source branch to create a backmerge PR from, in the format `release/x.y.z`',
|
226
|
+
optional: false,
|
227
|
+
type: String
|
228
|
+
),
|
229
|
+
FastlaneCore::ConfigItem.new(
|
230
|
+
key: :default_branch,
|
231
|
+
description: 'The default branch to target if no newer release branches exist',
|
232
|
+
optional: true,
|
233
|
+
default_value: DEFAULT_BRANCH,
|
234
|
+
type: String
|
235
|
+
),
|
236
|
+
FastlaneCore::ConfigItem.new(
|
237
|
+
key: :target_branches,
|
238
|
+
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`',
|
239
|
+
optional: true,
|
240
|
+
default_value: [],
|
241
|
+
type: Array
|
242
|
+
),
|
243
|
+
FastlaneCore::ConfigItem.new(
|
244
|
+
key: :milestone_title,
|
245
|
+
description: 'The title of the milestone to assign to the created PRs',
|
246
|
+
optional: true,
|
247
|
+
type: String
|
248
|
+
),
|
249
|
+
FastlaneCore::ConfigItem.new(
|
250
|
+
key: :intermediate_branch_created_callback,
|
251
|
+
description: 'Callback to allow for the caller to perform operations on the intermediate branch (e.g. pushing new commits to pre-solve conflicts) before creating the PR. ' \
|
252
|
+
+ 'The callback receives two parameters: the base (target) branch for the PR and the intermediate branch name that has been created.' \
|
253
|
+
+ 'Note that if you use the callback to add new commits to the intermediate branch, you are responsible for git-pushing them too',
|
254
|
+
optional: true,
|
255
|
+
type: Proc
|
256
|
+
),
|
238
257
|
]
|
239
258
|
end
|
240
259
|
|
data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/prototype_build_details_comment_action.rb
CHANGED
@@ -102,12 +102,15 @@ module Fastlane
|
|
102
102
|
# @return [Hash<String, String>] A hash of all the metadata, consolidated from both the explicit and the implicit ones
|
103
103
|
#
|
104
104
|
def self.generate_metadata_hash(params:, release_info:)
|
105
|
+
# Add explicit metadata provided by the caller
|
105
106
|
metadata = params[:metadata]&.transform_keys(&:to_s) || {}
|
106
107
|
|
107
108
|
# Add Firebase-specific metadata if available
|
108
|
-
|
109
|
-
|
110
|
-
|
109
|
+
unless release_info.nil?
|
110
|
+
metadata['Build Number'] ||= "<code>#{release_info.build_version}</code>"
|
111
|
+
metadata['Version'] ||= "<code>#{release_info.display_version}</code>"
|
112
|
+
metadata[release_info.os == 'ios' ? 'Bundle ID' : 'Application ID'] ||= "<code>#{release_info.bundle_id}</code>"
|
113
|
+
end
|
111
114
|
|
112
115
|
# Add git metadata
|
113
116
|
metadata['Commit'] ||= ENV.fetch('BUILDKITE_COMMIT', nil) || other_action.last_git_commit[:abbreviated_commit_hash]
|
@@ -342,7 +342,10 @@ module Fastlane
|
|
342
342
|
#
|
343
343
|
def self.post_process_xml!(translated_xml, locale_code:, original_xml:)
|
344
344
|
copy_orig_attributes = lambda do |node, xpath|
|
345
|
-
|
345
|
+
found_node = original_xml.xpath(xpath)&.first
|
346
|
+
return unless found_node
|
347
|
+
|
348
|
+
orig_attributes = found_node.attribute_nodes&.to_h do |attr|
|
346
349
|
[[attr.namespace&.prefix, attr.name].compact.join(':'), attr.value]
|
347
350
|
end
|
348
351
|
orig_attributes&.each { |k, v| node[k] = v unless k == 'name' }
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'fastlane'
|
4
|
+
|
5
|
+
# This monkey-patch adds Buildkite-aware logs to fastlane so it generates a collapsible log group in Buildkite for each action execution.
|
6
|
+
#
|
7
|
+
# @env `FASTLANE_DISABLE_ACTIONS_BUILDKITE_LOG_GROUPS`
|
8
|
+
# Set this variable to '1' to disable the auto-application of the monkey patch.
|
9
|
+
|
10
|
+
unless !ENV.key?('BUILDKITE') || FastlaneCore::Env.truthy?('FASTLANE_DISABLE_ACTIONS_BUILDKITE_LOG_GROUPS')
|
11
|
+
FastlaneCore::UI.verbose('Monkey-patching fastlane to add Buildkite-aware log groups for each action execution')
|
12
|
+
|
13
|
+
module Fastlane
|
14
|
+
module Actions
|
15
|
+
module SharedValues
|
16
|
+
# This differs from the existing `SharedValues::LANE_NAME`, which always contains the name of the **top-level** lane
|
17
|
+
CURRENTLY_RUNNING_LANE_NAME = :CURRENTLY_RUNNING_LANE_NAME
|
18
|
+
end
|
19
|
+
|
20
|
+
module BuildkiteLogActionsAsCollapsibleGroups
|
21
|
+
def execute_action(action_name, &)
|
22
|
+
unless %w[is_ci? is_ci].include?(action_name)
|
23
|
+
current_lane = lane_context[SharedValues::CURRENTLY_RUNNING_LANE_NAME]
|
24
|
+
lane_name_prefix = (current_lane || '').empty? ? '' : "[lane :#{current_lane}]"
|
25
|
+
puts "~~~ :fastlane: #{lane_name_prefix} #{action_name}"
|
26
|
+
end
|
27
|
+
super
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class << self
|
32
|
+
prepend BuildkiteLogActionsAsCollapsibleGroups
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
class Runner
|
37
|
+
prepend(Module.new do
|
38
|
+
def current_lane=(lane_name)
|
39
|
+
super
|
40
|
+
Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::CURRENTLY_RUNNING_LANE_NAME] = lane_name
|
41
|
+
end
|
42
|
+
end)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -54,7 +54,7 @@ module Fastlane
|
|
54
54
|
csv = "Version\t#{devices.join("\t")}\n"
|
55
55
|
app_sizes.each do |details|
|
56
56
|
build_number = details['cfBundleVersion']
|
57
|
-
sizes = details['sizesInBytes'].
|
57
|
+
sizes = details['sizesInBytes'].slice(*devices)
|
58
58
|
csv += "#{build_number}\t" + devices.map { |d| sz(sizes[d]['compressed']) }.join("\t") + "\n"
|
59
59
|
end
|
60
60
|
csv
|
@@ -64,7 +64,7 @@ module Fastlane
|
|
64
64
|
devices = DEFAULT_DEVICES if devices.nil? || devices.empty?
|
65
65
|
app_sizes.map do |details|
|
66
66
|
build_number = details['cfBundleVersion']
|
67
|
-
sizes = details['sizesInBytes'].
|
67
|
+
sizes = details['sizesInBytes'].slice(*devices)
|
68
68
|
col_size = devices.map(&:length).max
|
69
69
|
table = "| #{build_number.ljust(col_size)} | Download | Install |\n"
|
70
70
|
table += "|:#{'-' * col_size}-|---------:|---------:|\n"
|
@@ -65,10 +65,10 @@ module Fastlane
|
|
65
65
|
# Inspects the given `.strings` file for duplicated keys, returning them if any.
|
66
66
|
#
|
67
67
|
# @param [String] file The path to the file to inspect.
|
68
|
-
# @return [Hash<String, Array<Int>] Hash with the
|
68
|
+
# @return [Hash<String, Array<Int>] Hash with the duplicated keys.
|
69
69
|
# Each element has the duplicated key (from the `.strings`) as key and an array of line numbers where the key occurs as value.
|
70
70
|
def self.find_duplicated_keys(file:)
|
71
|
-
keys_with_lines = Hash.new
|
71
|
+
keys_with_lines = Hash.new { |h, k| h[k] = [] }
|
72
72
|
|
73
73
|
state = State.new(context: :root, buffer: StringIO.new, in_escaped_ctx: false, found_key: nil)
|
74
74
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-wpmreleasetoolkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 13.
|
4
|
+
version: 13.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Automattic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-03-
|
11
|
+
date: 2025-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -457,6 +457,7 @@ files:
|
|
457
457
|
- lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_tools_path_helper.rb
|
458
458
|
- lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_version_helper.rb
|
459
459
|
- lib/fastlane/plugin/wpmreleasetoolkit/helper/app_size_metrics_helper.rb
|
460
|
+
- lib/fastlane/plugin/wpmreleasetoolkit/helper/buildkite_aware_log_groups.rb
|
460
461
|
- lib/fastlane/plugin/wpmreleasetoolkit/helper/ci_helper.rb
|
461
462
|
- lib/fastlane/plugin/wpmreleasetoolkit/helper/configure_helper.rb
|
462
463
|
- lib/fastlane/plugin/wpmreleasetoolkit/helper/encryption_helper.rb
|