fastlane-plugin-wpmreleasetoolkit 6.3.0 → 7.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_update_metadata_source_action.rb +5 -5
  3. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_validate_lib_strings_action.rb +17 -5
  4. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_betabuild_prechecks.rb +2 -2
  5. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_build_prechecks.rb +4 -4
  6. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_hotfix.rb +2 -2
  7. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_codefreeze_prechecks.rb +1 -1
  8. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_completecodefreeze_prechecks.rb +4 -2
  9. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_create_xml_release_notes.rb +4 -4
  10. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_translations_action.rb +1 -1
  11. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_finalize_prechecks.rb +4 -2
  12. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_hotfix_prechecks.rb +2 -2
  13. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_tag_build.rb +1 -1
  14. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_update_release_notes.rb +2 -2
  15. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_annotate_action.rb +85 -0
  16. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_metadata_action.rb +67 -0
  17. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_trigger_build_action.rb +10 -2
  18. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/check_for_toolkit_updates_action.rb +4 -4
  19. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/check_translation_progress.rb +2 -2
  20. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_new_milestone_action.rb +3 -3
  21. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_release_action.rb +2 -2
  22. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/extract_release_notes_for_version_action.rb +3 -3
  23. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/get_prs_list_action.rb +2 -2
  24. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_downloadmetadata_action.rb +4 -4
  25. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_update_metadata_source.rb +5 -5
  26. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/prototype_build_details_comment_action.rb +259 -0
  27. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/setfrozentag_action.rb +2 -2
  28. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_apply_action.rb +1 -1
  29. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_update_action.rb +1 -1
  30. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_development_certificates_to_provisioning_profiles.rb +2 -2
  31. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_devices_to_provisioning_profiles.rb +2 -2
  32. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_betabuild_prechecks.rb +3 -3
  33. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_build_prechecks.rb +4 -4
  34. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_build_preflight.rb +1 -1
  35. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_hotfix.rb +3 -3
  36. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_release.rb +3 -21
  37. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_check_beta_deps.rb +1 -1
  38. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_clear_intermediate_tags.rb +15 -3
  39. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_codefreeze_prechecks.rb +1 -1
  40. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_completecodefreeze_prechecks.rb +4 -2
  41. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_download_strings_files_from_glotpress.rb +1 -1
  42. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_extract_keys_from_strings_files.rb +2 -2
  43. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_final_tag.rb +15 -3
  44. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_finalize_prechecks.rb +4 -2
  45. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_generate_strings_file_from_code.rb +3 -3
  46. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_build_number.rb +54 -0
  47. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_build_version.rb +1 -1
  48. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_hotfix_prechecks.rb +2 -2
  49. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_lint_localizations.rb +3 -3
  50. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata_source.rb +2 -2
  51. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_release_notes.rb +2 -2
  52. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/an_metadata_update_helper.rb +2 -2
  53. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb +2 -2
  54. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_version_helper.rb +2 -2
  55. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/git_helper.rb +17 -0
  56. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/glotpress_helper.rb +1 -1
  57. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_linter_helper.rb +1 -1
  58. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_download_helper.rb +2 -2
  59. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_update_helper.rb +1 -1
  60. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/promo_screenshots_helper.rb +1 -1
  61. data/lib/fastlane/plugin/wpmreleasetoolkit/version.rb +1 -1
  62. metadata +12 -8
@@ -36,7 +36,7 @@ module Fastlane
36
36
  target = self.create_target_file_path(orig)
37
37
 
38
38
  # Clear if older exists
39
- File.delete(target) if File.exist? target
39
+ FileUtils.rm_f(target)
40
40
 
41
41
  # Create the new one
42
42
  begin
@@ -46,7 +46,7 @@ module Fastlane
46
46
  end
47
47
  end
48
48
  rescue
49
- File.delete(target) if File.exist? target
49
+ FileUtils.rm_f(target)
50
50
  raise
51
51
  end
52
52
 
@@ -56,7 +56,7 @@ module Fastlane
56
56
  # Deletes the old po and moves the temp one
57
57
  # to the final location
58
58
  def self.swap_po(orig_file_path, temp_file_path)
59
- File.delete(orig_file_path) if File.exist? orig_file_path
59
+ FileUtils.rm_f(orig_file_path)
60
60
  File.rename(temp_file_path, orig_file_path)
61
61
  end
62
62
 
@@ -130,7 +130,7 @@ module Fastlane
130
130
  FastlaneCore::ConfigItem.new(key: :po_file_path,
131
131
  env_name: 'FL_UPDATE_METADATA_SOURCE_PO_FILE_PATH',
132
132
  description: 'The path of the .po file to update',
133
- is_string: true,
133
+ type: String,
134
134
  verify_block: proc do |value|
135
135
  UI.user_error!("No .po file path for UpdateMetadataSourceAction given, pass using `po_file_path: 'file path'`") unless value && (!value.empty?)
136
136
  UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value)
@@ -144,7 +144,7 @@ module Fastlane
144
144
  FastlaneCore::ConfigItem.new(key: :source_files,
145
145
  env_name: 'FL_UPDATE_METADATA_SOURCE_SOURCE_FILES',
146
146
  description: 'The hash with the path to the source files and the key to use to include their content',
147
- is_string: false,
147
+ type: Hash,
148
148
  verify_block: proc do |value|
149
149
  UI.user_error!("No source file hash for UpdateMetadataSourceAction given, pass using `source_files: 'source file hash'`") unless value && (!value.empty?)
150
150
  end),
@@ -0,0 +1,259 @@
1
+ module Fastlane
2
+ module Actions
3
+ class PrototypeBuildDetailsCommentAction < Action
4
+ def self.run(params)
5
+ app_display_name = params[:app_display_name]
6
+ app_center_info = AppCenterInfo.from_params(params)
7
+ metadata = consolidate_metadata(params, app_center_info)
8
+
9
+ qr_code_url, extra_metadata = build_install_links(app_center_info, params[:download_url])
10
+ metadata.merge!(extra_metadata)
11
+
12
+ # Build the comment parts
13
+ icon_img_tag = img_tag(params[:app_icon] || app_center_info.icon, alt: app_display_name)
14
+ metadata_rows = metadata.compact.map { |key, value| "<tr><td><b>#{key}</b></td><td>#{value}</td></tr>" }
15
+ intro = "#{icon_img_tag}📲 You can test the changes from this Pull Request in <b>#{app_display_name}</b> by scanning the QR code below to install the corresponding build."
16
+ footnote = params[:footnote] || (app_center_info.org_name.nil? ? '' : DEFAULT_APP_CENTER_FOOTNOTE)
17
+ body = <<~COMMENT_BODY
18
+ <table>
19
+ <tr>
20
+ <td rowspan='#{metadata_rows.count + 1}' width='260px'><img src='#{qr_code_url}' width='250' height='250' /></td>
21
+ <td><b>App Name</b></td><td>#{icon_img_tag} #{app_display_name}</td>
22
+ </tr>
23
+ #{metadata_rows.join("\n")}
24
+ </table>
25
+ #{footnote}
26
+ COMMENT_BODY
27
+
28
+ if params[:fold]
29
+ "<details><summary>#{intro}</summary>\n#{body}</details>\n"
30
+ else
31
+ "<p>#{intro}</p>\n#{body}"
32
+ end
33
+ end
34
+
35
+ #####################################################
36
+ # @!group Helpers
37
+ #####################################################
38
+
39
+ NO_INSTALL_URL_ERROR_MESSAGE = <<~NO_URL_ERROR.freeze
40
+ No URL provided to download or install the app.
41
+ - Either use this action right after using `appcenter_upload` and provide an `app_center_org_name` (so that this action can use the link to the App Center build)
42
+ - Or provide an explicit value for the `download_url` parameter
43
+ NO_URL_ERROR
44
+
45
+ DEFAULT_APP_CENTER_FOOTNOTE = '<em>Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.</em>'.freeze
46
+
47
+ # A small model struct to consolidate and pack all the values related to App Center
48
+ #
49
+ AppCenterInfo = Struct.new(:org_name, :app_name, :display_name, :release_id, :icon, :version, :short_version, :os, :bundle_id) do
50
+ # A method to construct an AppCenterInfo instance from the action params, and infer the rest from the `lane_context` if available
51
+ def self.from_params(params)
52
+ org_name = params[:app_center_org_name]
53
+ ctx = if org_name && defined?(SharedValues::APPCENTER_BUILD_INFORMATION)
54
+ Fastlane::Actions.lane_context[SharedValues::APPCENTER_BUILD_INFORMATION] || {}
55
+ else
56
+ {}
57
+ end
58
+ app_name = params[:app_center_app_name] || ctx['app_name']
59
+ new(
60
+ org_name,
61
+ app_name,
62
+ ctx['app_display_name'] || app_name,
63
+ params[:app_center_release_id] || ctx['id'],
64
+ ctx['app_icon_url'],
65
+ ctx['version'],
66
+ ctx['short_version'],
67
+ ctx['app_os'],
68
+ ctx['bundle_identifier']
69
+ )
70
+ end
71
+ end
72
+
73
+ # Builds the installation link, QR code URL and extra metadata for download links from the available info
74
+ #
75
+ # @param [AppCenterInfo] app_center_info The struct containing all the values related to App Center info
76
+ # @param [String] download_url The `download_url` parameter passed to the action, if one exists
77
+ # @return [(String, Hash<String,String>)] A tuple containing:
78
+ # - The URL for the QR Code
79
+ # - A Hash of the extra metadata key/value pairs to add to the existing metadata, to enrich them with download/install links
80
+ #
81
+ def self.build_install_links(app_center_info, download_url)
82
+ install_url = nil
83
+ extra_metadata = {}
84
+ if download_url
85
+ install_url = download_url
86
+ extra_metadata['Direct Download'] = "<a href='#{install_url}'><code>#{File.basename(install_url)}</code></a>"
87
+ end
88
+ if app_center_info.org_name && app_center_info.app_name
89
+ install_url = "https://install.appcenter.ms/orgs/#{app_center_info.org_name}/apps/#{app_center_info.app_name}/releases/#{app_center_info.release_id}"
90
+ extra_metadata['App Center Build'] = "<a href='#{install_url}'>#{app_center_info.display_name} ##{app_center_info.release_id}</a>"
91
+ end
92
+ UI.user_error!(NO_INSTALL_URL_ERROR_MESSAGE) if install_url.nil?
93
+ qr_code_url = "https://chart.googleapis.com/chart?chs=500x500&cht=qr&chl=#{CGI.escape(install_url)}&choe=UTF-8"
94
+ [qr_code_url, extra_metadata]
95
+ end
96
+
97
+ # A method to build the Hash of metadata, based on the explicit ones passed by the user as parameter + the implicit ones from `AppCenterInfo`
98
+ #
99
+ # @param [Hash<Symbol, Any>] params The action's parameters, as received by `self.run`
100
+ # @param [AppCenterInfo] app_center_info The model object containing all the values related to App Center information
101
+ # @return [Hash<String, String>] A hash of all the metadata, gathered from both the explicit and the implicit ones
102
+ #
103
+ def self.consolidate_metadata(params, app_center_info)
104
+ metadata = params[:metadata]&.transform_keys(&:to_s) || {}
105
+ metadata['Build Number'] ||= app_center_info.version
106
+ metadata['Version'] ||= app_center_info.short_version
107
+ metadata[app_center_info.os == 'Android' ? 'Application ID' : 'Bundle ID'] ||= app_center_info.bundle_id
108
+ # (Feel free to add more CI-specific env vars in the line below to support other CI providers if you need)
109
+ metadata['Commit'] ||= ENV.fetch('BUILDKITE_COMMIT', nil) || other_action.last_git_commit[:abbreviated_commit_hash]
110
+ metadata
111
+ end
112
+
113
+ # Creates an HTML `<img>` tag for an icon URL or the image URL to represent a given Buildkite emoji
114
+ #
115
+ # @param [String] url_or_emoji A `String` which can be:
116
+ # - Either a valid URI to an image
117
+ # - Or a string formatted like `:emojiname:`, using a valid Buildite emoji name as defined in https://github.com/buildkite/emojis
118
+ # @param [String] alt The alt text to use for the `<img>` tag
119
+ # @return [String] The `<img …>` tag with the proper image and alt tag
120
+ #
121
+ def self.img_tag(url_or_emoji, alt: '')
122
+ return nil if url_or_emoji.nil?
123
+
124
+ emoji = url_or_emoji.match(/:(.*):/)&.captures&.first
125
+ app_icon_url = if emoji
126
+ "https://raw.githubusercontent.com/buildkite/emojis/main/img-buildkite-64/#{emoji}.png"
127
+ elsif URI(url_or_emoji)
128
+ url_or_emoji
129
+ end
130
+ app_icon_url ? "<img alt='#{alt}' align='top' src='#{app_icon_url}' width='20px' />" : ''
131
+ end
132
+
133
+ #####################################################
134
+ # @!group Documentation
135
+ #####################################################
136
+
137
+ def self.description
138
+ 'Generates a string providing all the details of a prototype build, nicely-formatted and ready to be used as a PR comment (e.g. via `comment_on_pr`).'
139
+ end
140
+
141
+ def self.details
142
+ <<~DESC
143
+ Generates a string providing all the details of a prototype build, nicely-formatted as HTML.
144
+ The returned string will typically be subsequently used by the `comment_on_pr` action to post that HTML as comment on a PR.
145
+
146
+ If you used the `appcenter_upload` lane (to upload the Prototype build to App Center) before calling this action, and pass
147
+ a value to the `app_center_org_name` parameter, then many of the parameters and metadata will be automatically extracted
148
+ from the `lane_context` provided by `appcenter_upload`, including:
149
+
150
+ - The `app_center_app_name`, `app_center_release_id` and installation URL to use for the QR code to point to that release in App Center
151
+ - The `app_icon`
152
+ - The app's Build Number / versionCode
153
+ - The app's Version / versionName
154
+ - The app's Bundle ID / Application ID
155
+ - A `footnote` mentioning the MC tool for Automatticians to add themselves to App Center
156
+
157
+ This means that if you are using App Center to distribute your Prototype Build, the only parameters you *have* to provide
158
+ to this action are `app_display_name` and `app_center_org_name`; plus, for `metadata` most of the interesting values will already be pre-filled.
159
+
160
+ Any of those implicit default values/metadata can of course be overridden by passing an explicit value to the appropriate parameter(s).
161
+ DESC
162
+ end
163
+
164
+ def self.available_options
165
+ app_center_auto = '(will be automatically extracted from `lane_context if you used `appcenter_upload` to distribute your Prototype build)'
166
+ [
167
+ FastlaneCore::ConfigItem.new(
168
+ key: :app_display_name,
169
+ env_name: 'FL_PROTOTYPE_BUILD_DETAILS_COMMENT_APP_DISPLAY_NAME',
170
+ description: 'The display name to use for the app in the comment message',
171
+ optional: false,
172
+ type: String
173
+ ),
174
+ FastlaneCore::ConfigItem.new(
175
+ key: :app_center_org_name,
176
+ env_name: 'APPCENTER_OWNER_NAME', # Intentionally the same as the one used by the `appcenter_upload` action
177
+ description: 'The name of the organization in App Center (if you used `appcenter_upload` to distribute your Prototype build)',
178
+ type: String,
179
+ optional: true
180
+ ),
181
+ FastlaneCore::ConfigItem.new(
182
+ key: :app_center_app_name,
183
+ env_name: 'APPCENTER_APP_NAME', # Intentionally the same as the one used by the `appcenter_upload` action
184
+ description: "The name of the app in App Center #{app_center_auto}",
185
+ type: String,
186
+ optional: true,
187
+ default_value_dynamic: true # As it will be extracted from the `lane_context`` if you used `appcenter_upload``
188
+ ),
189
+ FastlaneCore::ConfigItem.new(
190
+ key: :app_center_release_id,
191
+ env_name: 'APPCENTER_RELEASE_ID',
192
+ description: "The release ID/Number in App Center #{app_center_auto}",
193
+ type: String,
194
+ optional: true,
195
+ default_value_dynamic: true # As it will be extracted from the `lane_context`` if you used `appcenter_upload``
196
+ ),
197
+ FastlaneCore::ConfigItem.new(
198
+ key: :app_icon,
199
+ env_name: 'FL_PROTOTYPE_BUILD_DETAILS_COMMENT_APP_ICON',
200
+ description: "The name of an emoji from the https://github.com/buildkite/emojis list or the full image URL to use for the icon of the app in the message. #{app_center_auto}",
201
+ type: String,
202
+ optional: true,
203
+ default_value_dynamic: true # As it will be extracted from the `lane_context`` if you used `appcenter_upload``
204
+ ),
205
+ FastlaneCore::ConfigItem.new(
206
+ key: :download_url,
207
+ env_name: 'FL_PROTOTYPE_BUILD_DETAILS_COMMENT_DOWNLOAD_URL',
208
+ description: 'The URL to download the build as a direct download. ' \
209
+ + 'If you uploaded the build to App Center, we recommend leaving this nil (the comment will use the URL to the App Center build for the QR code)',
210
+ type: String,
211
+ optional: true,
212
+ default_value: nil
213
+ ),
214
+ FastlaneCore::ConfigItem.new(
215
+ key: :fold,
216
+ env_name: 'FL_PROTOTYPE_BUILD_DETAILS_COMMENT_FOLD',
217
+ description: 'If true, will wrap the HTML table inside a <details> block (hidden by default)',
218
+ type: Boolean,
219
+ default_value: false
220
+ ),
221
+ FastlaneCore::ConfigItem.new(
222
+ key: :metadata,
223
+ env_name: 'FL_PROTOTYPE_BUILD_DETAILS_COMMENT_METADATA',
224
+ description: 'All additional metadata (as key/value pairs) you want to include in the HTML table of the comment. ' \
225
+ + 'If you are running this action after `appcenter_upload`, some metadata will automatically be added to this list too',
226
+ type: Hash,
227
+ optional: true,
228
+ default_value_dynamic: true # As some metadata will be auto-filled if you used `appcenter_upload`
229
+ ),
230
+ FastlaneCore::ConfigItem.new(
231
+ key: :footnote,
232
+ env_name: 'FL_PROTOTYPE_BUILD_DETAILS_COMMENT_FOOTNOTE',
233
+ description: 'Optional footnote to add below the HTML table of the comment. ' \
234
+ + 'If you are running this action after `appcenter_upload`, a default footnote for Automatticians will be used unless you provide an explicit value',
235
+ type: String,
236
+ optional: true,
237
+ default_value_dynamic: true # We have a default footnote for the case when you used App Center
238
+ ),
239
+ ]
240
+ end
241
+
242
+ def self.return_type
243
+ :string
244
+ end
245
+
246
+ def self.return_value
247
+ 'The HTML comment containing all the relevant info about a Prototype build and links to install it'
248
+ end
249
+
250
+ def self.authors
251
+ ['Automattic']
252
+ end
253
+
254
+ def self.is_supported?(platform)
255
+ true
256
+ end
257
+ end
258
+ end
259
+ end
@@ -68,10 +68,10 @@ module Fastlane
68
68
  optional: false,
69
69
  type: String),
70
70
  FastlaneCore::ConfigItem.new(key: :freeze,
71
- description: 'The GitHub milestone',
71
+ description: 'If true, the action will add the ❄️ emoji to the milestone title',
72
72
  optional: false,
73
73
  default_value: true,
74
- is_string: false),
74
+ type: Boolean),
75
75
  Fastlane::Helper::GithubHelper.github_token_config_item,
76
76
  ]
77
77
  end
@@ -127,7 +127,7 @@ module Fastlane
127
127
  description: 'Overwrite copied files without confirmation',
128
128
  optional: true,
129
129
  default_value: false,
130
- is_string: false),
130
+ type: Boolean),
131
131
  ]
132
132
  end
133
133
 
@@ -46,7 +46,7 @@ module Fastlane
46
46
 
47
47
  def self.prompt_to_switch_branches
48
48
  branch_name_to_display = current_branch.nil? ? current_hash : current_branch
49
- if UI.confirm("The current branch is `#{branch_name_to_display}`. Would you like to switch branches?")
49
+ if UI.confirm("The current Mobile Secrets branch is `#{branch_name_to_display}`. Would you like to switch branches?")
50
50
  new_branch = UI.select("Select the branch you'd like to switch to: ", get_branches)
51
51
  checkout_branch(new_branch)
52
52
  update_configure_file
@@ -43,13 +43,13 @@ module Fastlane
43
43
  [
44
44
  FastlaneCore::ConfigItem.new(key: :app_identifier,
45
45
  description: 'List of App Identifiers that should contain the new device identifier',
46
- is_string: false,
46
+ type: Array,
47
47
  verify_block: proc do |value|
48
48
  UI.user_error!('You must provide an array of bundle identifiers in `app_identifier`') if value.empty?
49
49
  end),
50
50
  FastlaneCore::ConfigItem.new(key: :team_id,
51
51
  description: 'The team_id for the provisioning profiles',
52
- is_string: true,
52
+ type: String,
53
53
  verify_block: proc do |value|
54
54
  UI.user_error!('You must provide a team ID in `team_id`') unless value && (!value.empty?)
55
55
  end),
@@ -42,7 +42,7 @@ module Fastlane
42
42
  FastlaneCore::ConfigItem.new(
43
43
  key: :app_identifier,
44
44
  description: 'List of App Identifiers that should contain the new device identifier',
45
- is_string: false,
45
+ type: Array,
46
46
  verify_block: proc do |value|
47
47
  UI.user_error!('You must provide an array of bundle identifiers in `app_identifier`') if value.empty?
48
48
  end
@@ -50,7 +50,7 @@ module Fastlane
50
50
  FastlaneCore::ConfigItem.new(
51
51
  key: :team_id,
52
52
  description: 'The team_id for the provisioning profiles',
53
- is_string: true,
53
+ type: String,
54
54
  verify_block: proc do |value|
55
55
  UI.user_error!('You must provide a team ID in `team_id`') unless value && (!value.empty?)
56
56
  end
@@ -63,12 +63,12 @@ module Fastlane
63
63
  FastlaneCore::ConfigItem.new(key: :base_version,
64
64
  env_name: 'FL_IOS_BETABUILD_PRECHECKS_BASE_VERSION',
65
65
  description: 'The version to work on', # a short description of this parameter
66
- is_string: true,
67
- optional: true), # true: verifies the input is a string, false: every kind of value),
66
+ type: String,
67
+ optional: true),
68
68
  FastlaneCore::ConfigItem.new(key: :skip_confirm,
69
69
  env_name: 'FL_IOS_BETABUILD_PRECHECKS_SKIPCONFIRM',
70
70
  description: 'Skips confirmation',
71
- is_string: false, # true: verifies the input is a string, false: every kind of value
71
+ type: Boolean,
72
72
  default_value: false), # the default value if the user didn't provide one
73
73
  FastlaneCore::ConfigItem.new(key: :default_branch,
74
74
  env_name: 'FL_RELEASE_TOOLKIT_DEFAULT_BRANCH',
@@ -36,22 +36,22 @@ module Fastlane
36
36
  FastlaneCore::ConfigItem.new(key: :skip_confirm,
37
37
  env_name: 'FL_IOS_BUILD_PRECHECKS_SKIP_CONFIRM',
38
38
  description: 'True to avoid the system ask for confirmation',
39
- is_string: false,
39
+ type: Boolean,
40
40
  default_value: false),
41
41
  FastlaneCore::ConfigItem.new(key: :internal,
42
42
  env_name: 'FL_IOS_BUILD_PRECHECKS_INTERNAL_BUILD',
43
43
  description: 'True if this is for an internal build',
44
- is_string: false,
44
+ type: Boolean,
45
45
  default_value: false),
46
46
  FastlaneCore::ConfigItem.new(key: :external,
47
47
  env_name: 'FL_IOS_BUILD_PRECHECKS_EXTERNAL_BUILD',
48
48
  description: 'True if this is for a public build',
49
- is_string: false,
49
+ type: Boolean,
50
50
  default_value: false),
51
51
  FastlaneCore::ConfigItem.new(key: :internal_on_single_version,
52
52
  env_name: 'FL_IOS_BUILD_PRECHECKS_INTERNAL_SV_BUILD',
53
53
  description: 'True if this is for an internal build that follows the same versioning of the external',
54
- is_string: false,
54
+ type: Boolean,
55
55
  default_value: false),
56
56
  ]
57
57
  end
@@ -53,7 +53,7 @@ module Fastlane
53
53
  FastlaneCore::ConfigItem.new(
54
54
  key: :derived_data_path,
55
55
  description: "The path to the DerivedData directory for the project. Should match what's used in the `gym` action",
56
- is_string: true,
56
+ type: String,
57
57
  default_value: '~/Library/Developer/Xcode/DerivedData'
58
58
  ),
59
59
  ]
@@ -43,19 +43,19 @@ module Fastlane
43
43
  key: :version,
44
44
  env_name: 'FL_IOS_BUMP_VERSION_HOTFIX_VERSION',
45
45
  description: 'The version of the hotfix',
46
- is_string: true
46
+ type: String
47
47
  ),
48
48
  FastlaneCore::ConfigItem.new(
49
49
  key: :previous_version,
50
50
  env_name: 'FL_IOS_BUMP_VERSION_HOTFIX_PREVIOUS_VERSION',
51
51
  description: 'The version to branch from',
52
- is_string: true
52
+ type: String
53
53
  ),
54
54
  FastlaneCore::ConfigItem.new(
55
55
  key: :skip_deliver,
56
56
  env_name: 'FL_IOS_BUMP_VERSION_HOTFIX_SKIP_DELIVER',
57
57
  description: 'Skips Deliverfile key update',
58
- is_string: false, # Boolean parameter
58
+ type: Boolean,
59
59
  optional: true,
60
60
  # Don't skip the Deliverfile by default. At the time of writing, 2 out of 3 consumers
61
61
  # still have a Deliverfile.
@@ -21,10 +21,6 @@ module Fastlane
21
21
  Fastlane::Helper::GitHelper.create_branch(@new_release_branch, from: default_branch)
22
22
  UI.message 'Done!'
23
23
 
24
- UI.message 'Updating glotPressKeys...' unless params[:skip_glotpress]
25
- update_glotpress_key unless params[:skip_glotpress]
26
- UI.message 'Done' unless params[:skip_glotpress]
27
-
28
24
  UI.message 'Updating Fastlane deliver file...' unless params[:skip_deliver]
29
25
  Fastlane::Helper::Ios::VersionHelper.update_fastlane_deliver(@new_short_version) unless params[:skip_deliver]
30
26
  UI.message 'Done!' unless params[:skip_deliver]
@@ -35,7 +31,7 @@ module Fastlane
35
31
 
36
32
  Fastlane::Helper::Ios::GitHelper.commit_version_bump(
37
33
  include_deliverfile: !params[:skip_deliver],
38
- include_metadata: !params[:skip_glotpress]
34
+ include_metadata: false
39
35
  )
40
36
 
41
37
  UI.message 'Done.'
@@ -55,16 +51,11 @@ module Fastlane
55
51
 
56
52
  def self.available_options
57
53
  [
58
- FastlaneCore::ConfigItem.new(key: :skip_glotpress,
59
- env_name: 'FL_IOS_CODEFREEZE_BUMP_SKIPGLOTPRESS',
60
- description: 'Skips GlotPress key update',
61
- is_string: false, # true: verifies the input is a string, false: every kind of value
62
- default_value: false), # the default value if the user didn't provide one
63
54
  FastlaneCore::ConfigItem.new(key: :skip_deliver,
64
55
  env_name: 'FL_IOS_CODEFREEZE_BUMP_SKIPDELIVER',
65
56
  description: 'Skips Deliver key update',
66
- is_string: false, # true: verifies the input is a string, false: every kind of value
67
- default_value: false), # the default value if the user didn't provide one
57
+ type: Boolean,
58
+ default_value: false),
68
59
  FastlaneCore::ConfigItem.new(key: :default_branch,
69
60
  env_name: 'FL_RELEASE_TOOLKIT_DEFAULT_BRANCH',
70
61
  description: 'Default branch of the repository',
@@ -105,15 +96,6 @@ module Fastlane
105
96
  UI.message("New short version: #{@new_short_version}")
106
97
  UI.message("Release branch: #{@new_release_branch}")
107
98
  end
108
-
109
- def self.update_glotpress_key
110
- dm_file = ENV['DOWNLOAD_METADATA']
111
- if File.exist?(dm_file)
112
- sh("sed -i '' \"s/let glotPressWhatsNewKey.*/let glotPressWhatsNewKey = \\\"v#{@new_short_version}-whats-new\\\"/\" #{dm_file}")
113
- else
114
- UI.user_error!("Can't find #{dm_file}.")
115
- end
116
- end
117
99
  end
118
100
  end
119
101
  end
@@ -39,7 +39,7 @@ module Fastlane
39
39
  FastlaneCore::ConfigItem.new(key: :podfile,
40
40
  env_name: 'FL_IOS_CHECKBETADEPS_PODFILE',
41
41
  description: 'Path to the Podfile to analyse',
42
- is_string: true),
42
+ type: String),
43
43
  ]
44
44
  end
45
45
 
@@ -2,6 +2,8 @@ module Fastlane
2
2
  module Actions
3
3
  class IosClearIntermediateTagsAction < Action
4
4
  def self.run(params)
5
+ return unless UI.confirm("#{deprecated_notes} Would you like to continue with the action?")
6
+
5
7
  UI.message("Deleting tags for version: #{params[:version]}")
6
8
 
7
9
  require_relative '../../helper/git_helper'
@@ -26,11 +28,11 @@ module Fastlane
26
28
  #####################################################
27
29
 
28
30
  def self.description
29
- 'Cleans all the intermediate tags for the given version'
31
+ '(DEPRECATED) Cleans all the intermediate tags for the given version'
30
32
  end
31
33
 
32
34
  def self.details
33
- 'Cleans all the intermediate tags for the given version'
35
+ '(DEPRECATED) Cleans all the intermediate tags for the given version'
34
36
  end
35
37
 
36
38
  def self.available_options
@@ -38,7 +40,7 @@ module Fastlane
38
40
  FastlaneCore::ConfigItem.new(key: :version,
39
41
  env_name: 'FL_IOS_CLEAN_INTERMEDIATE_TAGS_VERSION',
40
42
  description: 'The version of the tags to clear',
41
- is_string: true),
43
+ type: String),
42
44
  ]
43
45
  end
44
46
 
@@ -48,6 +50,16 @@ module Fastlane
48
50
  def self.return_value
49
51
  end
50
52
 
53
+ def self.category
54
+ :deprecated
55
+ end
56
+
57
+ def self.deprecated_notes
58
+ "This action is deprecated as we don't believe it's currently in use in our projects.
59
+ However, just to be sure that it's not in use, we decided to deprecate it first. If you
60
+ believe that this is a mistake, please let us know on Slack."
61
+ end
62
+
51
63
  def self.authors
52
64
  ['Automattic']
53
65
  end
@@ -47,7 +47,7 @@ module Fastlane
47
47
  FastlaneCore::ConfigItem.new(key: :skip_confirm,
48
48
  env_name: 'FL_IOS_CODEFREEZE_PRECHECKS_SKIPCONFIRM',
49
49
  description: 'Skips confirmation before codefreeze',
50
- is_string: false, # true: verifies the input is a string, false: every kind of value
50
+ type: Boolean,
51
51
  default_value: false), # the default value if the user didn't provide one
52
52
  FastlaneCore::ConfigItem.new(key: :default_branch,
53
53
  env_name: 'FL_RELEASE_TOOLKIT_DEFAULT_BRANCH',
@@ -6,8 +6,10 @@ module Fastlane
6
6
 
7
7
  require_relative '../../helper/ios/ios_version_helper'
8
8
  require_relative '../../helper/ios/ios_git_helper'
9
+ require_relative '../../helper/git_helper'
9
10
 
10
- UI.user_error!('This is not a release branch. Abort.') unless other_action.git_branch.start_with?('release/')
11
+ current_branch = Fastlane::Helper::GitHelper.current_git_branch
12
+ UI.user_error!("Current branch - '#{current_branch}' - is not a release branch. Abort.") unless current_branch.start_with?('release/')
11
13
 
12
14
  version = Fastlane::Helper::Ios::VersionHelper.get_public_version
13
15
  message = "Completing code freeze for: #{version}\n"
@@ -40,7 +42,7 @@ module Fastlane
40
42
  FastlaneCore::ConfigItem.new(key: :skip_confirm,
41
43
  env_name: 'FL_IOS_COMPLETECODEFREEZE_PRECHECKS_SKIPCONFIRM',
42
44
  description: 'Skips confirmation',
43
- is_string: false, # true: verifies the input is a string, false: every kind of value
45
+ type: Boolean,
44
46
  default_value: false), # the default value if the user didn't provide one
45
47
  ]
46
48
  end
@@ -13,7 +13,7 @@ module Fastlane
13
13
  UI.message "Downloading translations for '#{lproj_name}' from GlotPress (#{glotpress_locale}) [#{params[:filters]}]..."
14
14
  lproj_dir = File.join(download_dir, "#{lproj_name}.lproj")
15
15
  destination = File.join(lproj_dir, "#{params[:table_basename]}.strings")
16
- FileUtils.mkdir(lproj_dir) unless Dir.exist?(lproj_dir)
16
+ FileUtils.mkdir_p(lproj_dir)
17
17
 
18
18
  Fastlane::Helper::Ios::L10nHelper.download_glotpress_export_file(
19
19
  project_url: params[:project_url],
@@ -45,10 +45,10 @@ module Fastlane
45
45
  # @return [Hash<String, Array<String>>] The hash listing the keys to extract for each target file
46
46
  #
47
47
  def self.keys_list_per_target_file(original_files)
48
- original_files.map do |original_file|
48
+ original_files.to_h do |original_file|
49
49
  keys = Fastlane::Helper::Ios::L10nHelper.read_strings_file_as_hash(path: original_file).keys
50
50
  [original_file, keys]
51
- end.to_h
51
+ end
52
52
  rescue StandardError => e
53
53
  UI.user_error!("Failed to read the keys to extract from originals file: #{e.message}")
54
54
  end