fastlane-plugin-wpmreleasetoolkit 7.0.0 → 8.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) 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 +4 -4
  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 +3 -3
  15. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_trigger_build_action.rb +10 -2
  16. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/check_for_toolkit_updates_action.rb +4 -4
  17. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/check_translation_progress.rb +2 -2
  18. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_new_milestone_action.rb +3 -3
  19. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_release_action.rb +2 -2
  20. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/extract_release_notes_for_version_action.rb +3 -3
  21. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/get_prs_list_action.rb +2 -2
  22. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_downloadmetadata_action.rb +4 -4
  23. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_update_metadata_source.rb +5 -5
  24. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/prototype_build_details_comment_action.rb +1 -1
  25. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/setfrozentag_action.rb +2 -2
  26. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_apply_action.rb +1 -1
  27. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_update_action.rb +1 -1
  28. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_development_certificates_to_provisioning_profiles.rb +2 -2
  29. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_devices_to_provisioning_profiles.rb +2 -2
  30. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_betabuild_prechecks.rb +3 -3
  31. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_build_prechecks.rb +4 -4
  32. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_build_preflight.rb +1 -1
  33. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_hotfix.rb +3 -3
  34. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_check_beta_deps.rb +1 -1
  35. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_clear_intermediate_tags.rb +15 -3
  36. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_codefreeze_prechecks.rb +1 -1
  37. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_completecodefreeze_prechecks.rb +4 -2
  38. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_download_strings_files_from_glotpress.rb +1 -1
  39. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_extract_keys_from_strings_files.rb +2 -2
  40. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_final_tag.rb +15 -3
  41. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_finalize_prechecks.rb +4 -2
  42. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_generate_strings_file_from_code.rb +3 -3
  43. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_build_number.rb +54 -0
  44. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_build_version.rb +1 -1
  45. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_hotfix_prechecks.rb +2 -2
  46. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_lint_localizations.rb +3 -3
  47. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata_source.rb +2 -3
  48. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_release_notes.rb +3 -3
  49. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/an_metadata_update_helper.rb +2 -2
  50. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_git_helper.rb +5 -6
  51. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb +2 -2
  52. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_version_helper.rb +2 -2
  53. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/git_helper.rb +21 -9
  54. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/glotpress_helper.rb +1 -1
  55. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_git_helper.rb +7 -7
  56. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_linter_helper.rb +1 -1
  57. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_download_helper.rb +2 -2
  58. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_update_helper.rb +1 -1
  59. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/promo_screenshots_helper.rb +1 -1
  60. data/lib/fastlane/plugin/wpmreleasetoolkit/version.rb +1 -1
  61. metadata +5 -4
@@ -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.
@@ -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
@@ -2,6 +2,8 @@ module Fastlane
2
2
  module Actions
3
3
  class IosFinalTagAction < 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
  require_relative '../../helper/ios/ios_git_helper'
6
8
  require_relative '../../helper/ios/ios_version_helper'
7
9
  version = Fastlane::Helper::Ios::VersionHelper.get_public_version
@@ -18,11 +20,11 @@ module Fastlane
18
20
  #####################################################
19
21
 
20
22
  def self.description
21
- 'Finalize a relasae'
23
+ '(DEPRECATED) Finalize a relasae'
22
24
  end
23
25
 
24
26
  def self.details
25
- 'Removes the temp tags and pushes the final one'
27
+ '(DEPRECATED) Removes the temp tags and pushes the final one'
26
28
  end
27
29
 
28
30
  def self.available_options
@@ -30,7 +32,7 @@ module Fastlane
30
32
  FastlaneCore::ConfigItem.new(key: :version,
31
33
  env_name: 'FL_IOS_FINAL_TAG_VERSION',
32
34
  description: 'The version of the release to finalize',
33
- is_string: true),
35
+ type: String),
34
36
  ]
35
37
  end
36
38
 
@@ -40,6 +42,16 @@ module Fastlane
40
42
  def self.return_value
41
43
  end
42
44
 
45
+ def self.category
46
+ :deprecated
47
+ end
48
+
49
+ def self.deprecated_notes
50
+ "This action is deprecated as we don't believe it's currently in use in our projects.
51
+ However, just to be sure that it's not in use, we decided to deprecate it first. If you
52
+ believe that this is a mistake, please let us know on Slack."
53
+ end
54
+
43
55
  def self.authors
44
56
  ['Automattic']
45
57
  end
@@ -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 = "Finalizing release: #{version}\n"
@@ -40,7 +42,7 @@ module Fastlane
40
42
  FastlaneCore::ConfigItem.new(key: :skip_confirm,
41
43
  env_name: 'FL_IOS_FINALIZE_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
@@ -74,12 +74,12 @@ module Fastlane
74
74
  FastlaneCore::ConfigItem.new(key: :quiet,
75
75
  env_name: 'FL_IOS_GENERATE_STRINGS_FILE_FROM_CODE_QUIET',
76
76
  description: 'In quiet mode, `genstrings` will log warnings about duplicate values, but not about duplicate comments',
77
- is_string: false, # Boolean
77
+ type: Boolean,
78
78
  default_value: true),
79
79
  FastlaneCore::ConfigItem.new(key: :swiftui,
80
80
  env_name: 'FL_IOS_GENERATE_STRINGS_FILE_FROM_CODE_SWIFTUI',
81
81
  description: "Should we include SwiftUI's `Text()` when parsing code with `genstrings`",
82
- is_string: false, # Boolean
82
+ type: Boolean,
83
83
  default_value: false),
84
84
  FastlaneCore::ConfigItem.new(key: :output_dir,
85
85
  env_name: 'FL_IOS_GENERATE_STRINGS_FILE_FROM_CODE_OUTPUT_DIR',
@@ -88,7 +88,7 @@ module Fastlane
88
88
  FastlaneCore::ConfigItem.new(key: :fail_on_error,
89
89
  env_name: 'FL_IOS_GENERATE_STRINGS_FILE_FROM_CODE_FAIL_ON_ERROR',
90
90
  description: 'If true, will fail with user_error! if `genstrings` printed any error while parsing',
91
- is_string: false, # Boolean
91
+ type: Boolean,
92
92
  default_value: true),
93
93
  ]
94
94
  end
@@ -0,0 +1,54 @@
1
+ module Fastlane
2
+ module Actions
3
+ class IosGetBuildNumberAction < Action
4
+ def self.run(params)
5
+ require_relative '../../helper/ios/ios_version_helper'
6
+
7
+ xcconfig_file_path = params[:xcconfig_file_path]
8
+ Fastlane::Helper::Ios::VersionHelper.read_build_number_from_config_file(xcconfig_file_path)
9
+ end
10
+
11
+ #####################################################
12
+ # @!group Documentation
13
+ #####################################################
14
+
15
+ def self.description
16
+ 'Gets the build number of the app'
17
+ end
18
+
19
+ def self.details
20
+ 'Gets the build number of the app'
21
+ end
22
+
23
+ def self.available_options
24
+ [
25
+ FastlaneCore::ConfigItem.new(
26
+ key: :xcconfig_file_path,
27
+ env_name: 'FL_IOS_XCCONFIG_FILE_PATH',
28
+ description: 'Path to the .xcconfig file containing the build number',
29
+ type: String,
30
+ optional: false
31
+ ),
32
+ ]
33
+ end
34
+
35
+ def self.output
36
+ # Define the shared values you are going to provide
37
+ end
38
+
39
+ def self.return_value
40
+ # If you method provides a return value, you can describe here what it does
41
+ 'Return the build number of the app'
42
+ end
43
+
44
+ def self.authors
45
+ # So no one will ever forget your contribution to fastlane :) You are awesome btw!
46
+ ['Automattic']
47
+ end
48
+
49
+ def self.is_supported?(platform)
50
+ [:ios, :mac].include?(platform)
51
+ end
52
+ end
53
+ end
54
+ end
@@ -32,7 +32,7 @@ module Fastlane
32
32
  key: :internal,
33
33
  env_name: 'FL_IOS_BUILD_VERSION_INTERNAL',
34
34
  description: 'If true, returns the internal build version, otherwise returns the public one',
35
- is_string: false, # Boolean
35
+ type: Boolean,
36
36
  default_value: false
37
37
  ),
38
38
  ]
@@ -51,11 +51,11 @@ module Fastlane
51
51
  FastlaneCore::ConfigItem.new(key: :version,
52
52
  env_name: 'FL_IOS_HOTFIX_PRECHECKS_VERSION',
53
53
  description: 'The version to work on', # a short description of this parameter
54
- is_string: true),
54
+ type: String),
55
55
  FastlaneCore::ConfigItem.new(key: :skip_confirm,
56
56
  env_name: 'FL_IOS_HOTFIX_PRECHECKS_SKIPCONFIRM',
57
57
  description: 'Skips confirmation',
58
- is_string: false, # true: verifies the input is a string, false: every kind of value
58
+ type: Boolean,
59
59
  default_value: false), # the default value if the user didn't provide one
60
60
  ]
61
61
  end
@@ -163,7 +163,7 @@ module Fastlane
163
163
  description: 'Should we abort the rest of the lane with a global error if any violations are found?',
164
164
  optional: true,
165
165
  default_value: true,
166
- is_string: false # https://docs.fastlane.tools/advanced/actions/#boolean-parameters
166
+ type: Boolean
167
167
  ),
168
168
  FastlaneCore::ConfigItem.new(
169
169
  key: :allow_retry,
@@ -171,7 +171,7 @@ module Fastlane
171
171
  description: 'If any violations are found, show an interactive prompt allowing the user to manually fix the issues locally and retry the linting',
172
172
  optional: true,
173
173
  default_value: false,
174
- is_string: false # https://docs.fastlane.tools/advanced/actions/#boolean-parameters
174
+ type: Boolean
175
175
  ),
176
176
  FastlaneCore::ConfigItem.new(
177
177
  key: :check_duplicate_keys,
@@ -179,7 +179,7 @@ module Fastlane
179
179
  description: 'Checks the input files for duplicate keys',
180
180
  optional: true,
181
181
  default_value: true,
182
- is_string: false # https://docs.fastlane.tools/advanced/actions/#boolean-parameters
182
+ type: Boolean
183
183
  ),
184
184
  ]
185
185
  end
@@ -18,7 +18,6 @@ module Fastlane
18
18
  repo_clean = repo_status.empty?
19
19
  unless repo_clean
20
20
  Action.sh('git commit -m "Update metadata strings"')
21
- Action.sh('git push')
22
21
  end
23
22
  end
24
23
 
@@ -42,7 +41,7 @@ module Fastlane
42
41
  FastlaneCore::ConfigItem.new(key: :po_file_path,
43
42
  env_name: 'FL_IOS_UPDATE_METADATA_SOURCE_PO_FILE_PATH',
44
43
  description: 'The path of the .po file to update',
45
- is_string: true,
44
+ type: String,
46
45
  verify_block: proc do |value|
47
46
  UI.user_error!("No .po file path for UpdateMetadataSourceAction given, pass using `po_file_path: 'file path'`") unless value && (!value.empty?)
48
47
  UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value)
@@ -56,7 +55,7 @@ module Fastlane
56
55
  FastlaneCore::ConfigItem.new(key: :source_files,
57
56
  env_name: 'FL_IOS_UPDATE_METADATA_SOURCE_SOURCE_FILES',
58
57
  description: 'The hash with the path to the source files and the key to use to include their content',
59
- is_string: false,
58
+ type: Hash,
60
59
  verify_block: proc do |value|
61
60
  UI.user_error!("No source file hash for UpdateMetadataSourceAction given, pass using `source_files: 'source file hash'`") unless value && (!value.empty?)
62
61
  end),
@@ -12,7 +12,7 @@ module Fastlane
12
12
  next_version = Fastlane::Helper::Ios::VersionHelper.calc_next_release_version(params[:new_version])
13
13
 
14
14
  Fastlane::Helper::ReleaseNotesHelper.add_new_section(path: path, section_title: next_version)
15
- Fastlane::Helper::GitHelper.commit(message: "Release Notes: add new section for next version (#{next_version})", files: path, push: true)
15
+ Fastlane::Helper::GitHelper.commit(message: "Release Notes: add new section for next version (#{next_version})", files: path)
16
16
 
17
17
  UI.message 'Done.'
18
18
  end
@@ -34,11 +34,11 @@ module Fastlane
34
34
  FastlaneCore::ConfigItem.new(key: :new_version,
35
35
  env_name: 'FL_IOS_UPDATE_RELEASE_NOTES_VERSION',
36
36
  description: 'The version we are currently freezing; An empty entry for the _next_ version after this one will be added to the release notes',
37
- is_string: true),
37
+ type: String),
38
38
  FastlaneCore::ConfigItem.new(key: :release_notes_file_path,
39
39
  env_name: 'FL_IOS_UPDATE_RELEASE_NOTES_FILE_PATH',
40
40
  description: 'The path to the release notes file to be updated',
41
- is_string: true,
41
+ type: String,
42
42
  default_value: File.join(ENV['PROJECT_ROOT_FOLDER'] || '.', 'RELEASE-NOTES.txt')),
43
43
  ]
44
44
  end
@@ -50,7 +50,7 @@ module Fastlane
50
50
 
51
51
  if line_count <= 1
52
52
  # Single line output
53
- fw.puts("msgid \"#{File.open(@content_file_path, 'r').read.rstrip}\"")
53
+ fw.puts("msgid \"#{File.read(@content_file_path).rstrip}\"")
54
54
  else
55
55
  # Multiple line output
56
56
  fw.puts('msgid ""')
@@ -145,7 +145,7 @@ module Fastlane
145
145
  end
146
146
 
147
147
  def generate_block(fw)
148
- super(fw) unless File.zero?(@content_file_path)
148
+ super(fw) unless File.empty?(@content_file_path)
149
149
  end
150
150
  end
151
151
  end
@@ -4,9 +4,10 @@ module Fastlane
4
4
  # Helper methods to execute git-related operations that are specific to Android projects
5
5
  #
6
6
  module GitHelper
7
- # Commit and push the files that are modified when we bump version numbers on an iOS project
7
+ # Commit the files that are modified when we bump version numbers on an Android project
8
8
  #
9
- # This typically commits and pushes the `build.gradle` file inside the project subfolder.
9
+ # This typically commits the `version.properties` inside root folder or `build.gradle` file
10
+ # inside the project subfolder.
10
11
  #
11
12
  # @env PROJECT_ROOT_FOLDER The path to the git root of the project
12
13
  # @env PROJECT_NAME The name of the directory containing the project code (especially containing the `build.gradle` file)
@@ -16,14 +17,12 @@ module Fastlane
16
17
  if File.exist?(Fastlane::Helper::Android::VersionHelper.version_properties_file)
17
18
  Fastlane::Helper::GitHelper.commit(
18
19
  message: 'Bump version number',
19
- files: File.join(ENV['PROJECT_ROOT_FOLDER'], 'version.properties'),
20
- push: true
20
+ files: File.join(ENV['PROJECT_ROOT_FOLDER'], 'version.properties')
21
21
  )
22
22
  else
23
23
  Fastlane::Helper::GitHelper.commit(
24
24
  message: 'Bump version number',
25
- files: File.join(ENV['PROJECT_ROOT_FOLDER'], ENV['PROJECT_NAME'], 'build.gradle'),
26
- push: true
25
+ files: File.join(ENV['PROJECT_ROOT_FOLDER'], ENV['PROJECT_NAME'], 'build.gradle')
27
26
  )
28
27
  end
29
28
  end
@@ -240,7 +240,7 @@ module Fastlane
240
240
  attributes_to_copy = %w[formatted] # Attributes that we want to replicate into translated `string.xml` files
241
241
  orig_file = File.join(res_dir, 'values', 'strings.xml')
242
242
  orig_xml = File.open(orig_file) { |f| Nokogiri::XML(f, nil, Encoding::UTF_8.to_s) }
243
- orig_attributes = orig_xml.xpath('//string').map { |tag| [tag['name'], tag.attributes.select { |k, _| attributes_to_copy.include?(k) }] }.to_h
243
+ orig_attributes = orig_xml.xpath('//string').to_h { |tag| [tag['name'], tag.attributes.select { |k, _| attributes_to_copy.include?(k) }] }
244
244
 
245
245
  locales_map.each do |lang_codes|
246
246
  all_xml_documents = glotpress_filters.map do |filters|
@@ -262,7 +262,7 @@ module Fastlane
262
262
 
263
263
  # Save
264
264
  lang_dir = File.join(res_dir, "values-#{lang_codes[:android]}")
265
- FileUtils.mkdir(lang_dir) unless Dir.exist?(lang_dir)
265
+ FileUtils.mkdir_p(lang_dir)
266
266
  lang_file = File.join(lang_dir, 'strings.xml')
267
267
  File.open(lang_file, 'w') { |f| merged_xml.write_to(f, encoding: Encoding::UTF_8.to_s, indent: 4) }
268
268
  end
@@ -465,8 +465,8 @@ module Fastlane
465
465
  # @return [String] The path of the `build.gradle` file inside the project subfolder in the project's repo
466
466
  #
467
467
  def self.gradle_path
468
- UI.user_error!("You need to set the \`PROJECT_ROOT_FOLDER\` environment variable to the path to the project's root") if ENV['PROJECT_ROOT_FOLDER'].nil?
469
- UI.user_error!("You need to set the \`PROJECT_NAME\` environment variable to the relative path to the project subfolder name") if ENV['PROJECT_NAME'].nil?
468
+ UI.user_error!("You need to set the `PROJECT_ROOT_FOLDER` environment variable to the path to the project's root") if ENV['PROJECT_ROOT_FOLDER'].nil?
469
+ UI.user_error!('You need to set the `PROJECT_NAME` environment variable to the relative path to the project subfolder name') if ENV['PROJECT_NAME'].nil?
470
470
  File.join(ENV['PROJECT_ROOT_FOLDER'], ENV['PROJECT_NAME'], 'build.gradle')
471
471
  end
472
472
 
@@ -73,16 +73,15 @@ module Fastlane
73
73
  Action.sh('git', 'submodule', 'update', '--init', '--recursive')
74
74
  end
75
75
 
76
- # Create a new branch named `branch_name`, cutting it from branch/commit/tag `from`, and push it
76
+ # Create a new branch named `branch_name`, cutting it from branch/commit/tag `from`
77
77
  #
78
78
  # If the branch with that name already exists, it will instead switch to it and pull new commits.
79
79
  #
80
80
  # @param [String] branch_name The full name of the new branch to create, e.g "release/1.2"
81
81
  # @param [String?] from The branch or tag from which to cut the branch from.
82
82
  # If `nil`, will cut the new branch from the current commit. Otherwise, will checkout that commit/branch/tag before cutting the branch.
83
- # @param [Bool] push If true, will also push the branch to `origin`, tracking the upstream branch with the local one.
84
83
  #
85
- def self.create_branch(branch_name, from: nil, push: true)
84
+ def self.create_branch(branch_name, from: nil)
86
85
  if branch_exists?(branch_name)
87
86
  UI.message("Branch #{branch_name} already exists. Skipping creation.")
88
87
  Action.sh('git', 'checkout', branch_name)
@@ -90,22 +89,19 @@ module Fastlane
90
89
  else
91
90
  Action.sh('git', 'checkout', from) unless from.nil?
92
91
  Action.sh('git', 'checkout', '-b', branch_name)
93
- Action.sh('git', 'push', '-u', 'origin', branch_name) if push
94
92
  end
95
93
  end
96
94
 
97
95
  # `git add` the specified files (if any provided) then commit them using the provided message.
98
- # Optionally, push the commit to the remote too.
99
96
  #
100
97
  # @param [String] message The commit message to use
101
98
  # @param [String|Array<String>] files A file or array of files to git-add before creating the commit.
102
99
  # Use `nil` or `[]` if you already added the files in a separate step and don't wan't this method to add any new file before commit.
103
100
  # Also accepts the special symbol `:all` to add all the files (`git commit -a -m …`).
104
- # @param [Bool] push If true, will `git push` to `origin` after the commit has been created. Defaults to `false`.
105
101
  #
106
- # @return [Bool] True if commit and push were successful, false if there was an issue during commit & push (most likely being "nothing to commit").
102
+ # @return [Bool] True if commit was successful, false if there was an issue (most likely being "nothing to commit").
107
103
  #
108
- def self.commit(message:, files: nil, push: false)
104
+ def self.commit(message:, files: nil)
109
105
  files = [files] if files.is_a?(String)
110
106
  args = []
111
107
  if files == :all
@@ -115,7 +111,6 @@ module Fastlane
115
111
  end
116
112
  begin
117
113
  Action.sh('git', 'commit', *args, '-m', message)
118
- Action.sh('git', 'push', 'origin', 'HEAD') if push
119
114
  return true
120
115
  rescue
121
116
  return false
@@ -181,6 +176,23 @@ module Fastlane
181
176
  Action.sh('git', 'fetch', '--tags')
182
177
  end
183
178
 
179
+ # Returns the current git branch, or "HEAD" if it's not checked out to any branch
180
+ # Can NOT be replaced using the environment variables such as `GIT_BRANCH` or `BUILDKITE_BRANCH`
181
+ #
182
+ # `fastlane` already has a helper action for this called `git_branch`, however it's modified
183
+ # by CI environment variables. We need to check which branch we are actually on and not the
184
+ # initial branch a CI build is started from, so we are using the `git_branch_name_using_HEAD`
185
+ # helper instead.
186
+ #
187
+ # See https://docs.fastlane.tools/actions/git_branch/#git_branch
188
+ #
189
+ # @return [String] The current git branch, or "HEAD" if it's not checked out to any branch
190
+ #
191
+ def self.current_git_branch
192
+ # We can't use `other_action.git_branch`, because it is modified by environment variables in Buildkite.
193
+ Fastlane::Actions.git_branch_name_using_HEAD
194
+ end
195
+
184
196
  # Checks if a branch exists locally.
185
197
  #
186
198
  # @param [String] branch_name The name of the branch to check for
@@ -66,7 +66,7 @@ module Fastlane
66
66
  # @return [Integer] The percentage of the translated strings.
67
67
  #
68
68
  def self.extract_value_from_translation_info_data(data:, language_code:, status:)
69
- regex = "\/#{language_code}\/.*#{status}.*>([0-9,]+)"
69
+ regex = "/#{language_code}/.*#{status}.*>([0-9,]+)"
70
70
 
71
71
  # 1. Grep the line with contains the required info.
72
72
  # 2. Match the info and extract the value in group 1.