fastlane-plugin-wpmreleasetoolkit 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +339 -0
  3. data/README.md +38 -0
  4. data/bin/drawText +19 -0
  5. data/ext/drawText/extconf.rb +36 -0
  6. data/lib/fastlane/plugin/wpmreleasetoolkit.rb +16 -0
  7. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/README.md +20 -0
  8. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_localize_libs_action.rb +53 -0
  9. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_update_metadata_source_action.rb +171 -0
  10. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_validate_lib_strings_action.rb +63 -0
  11. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_betabuild_prechecks.rb +103 -0
  12. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_build_prechecks.rb +83 -0
  13. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_build_preflight.rb +54 -0
  14. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_beta.rb +69 -0
  15. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_final_release.rb +58 -0
  16. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_hotfix.rb +77 -0
  17. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_release.rb +89 -0
  18. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_codefreeze_prechecks.rb +79 -0
  19. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_completecodefreeze_prechecks.rb +68 -0
  20. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_create_xml_release_notes.rb +63 -0
  21. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_current_branch_is_hotfix.rb +44 -0
  22. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_file_by_version.rb +79 -0
  23. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_translations_action.rb +115 -0
  24. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_finalize_prechecks.rb +71 -0
  25. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_alpha_version.rb +44 -0
  26. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_app_version.rb +44 -0
  27. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_release_version.rb +44 -0
  28. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_hotifx_prechecks.rb +78 -0
  29. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_merge_translators_strings.rb +106 -0
  30. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_tag_build.rb +51 -0
  31. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_update_metadata.rb +52 -0
  32. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_update_release_notes.rb +56 -0
  33. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/circleci_trigger_job_action.rb +63 -0
  34. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/close_milestone_action.rb +56 -0
  35. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_new_milestone_action.rb +59 -0
  36. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_release_action.rb +91 -0
  37. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/extract_release_notes_for_version_action.rb +89 -0
  38. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/get_prs_list_action.rb +64 -0
  39. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_downloadmetadata_action.rb +90 -0
  40. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_update_metadata_source.rb +170 -0
  41. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/promo_screenshots_action.rb +247 -0
  42. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/removebranchprotection_action.rb +57 -0
  43. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/setbranchprotection_action.rb +56 -0
  44. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/setfrozentag_action.rb +81 -0
  45. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_add_files_to_copy_action.rb +96 -0
  46. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_apply_action.rb +139 -0
  47. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_download_action.rb +57 -0
  48. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_setup_action.rb +86 -0
  49. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_update_action.rb +139 -0
  50. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_validate_action.rb +134 -0
  51. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_development_certificates_to_provisioning_profiles.rb +77 -0
  52. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_devices_to_provisioning_profiles.rb +79 -0
  53. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_betabuild_prechecks.rb +92 -0
  54. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_build_prechecks.rb +74 -0
  55. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_build_preflight.rb +78 -0
  56. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_beta.rb +68 -0
  57. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_hotfix.rb +87 -0
  58. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_release.rb +114 -0
  59. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_check_beta_deps.rb +62 -0
  60. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_clear_intermediate_tags.rb +60 -0
  61. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_codefreeze_prechecks.rb +70 -0
  62. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_completecodefreeze_prechecks.rb +63 -0
  63. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_current_branch_is_hotfix.rb +40 -0
  64. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_final_tag.rb +52 -0
  65. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_finalize_prechecks.rb +64 -0
  66. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_app_version.rb +47 -0
  67. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_build_version.rb +60 -0
  68. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_store_app_sizes.rb +121 -0
  69. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_hotifx_prechecks.rb +78 -0
  70. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_lint_localizations.rb +167 -0
  71. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_localize_project.rb +44 -0
  72. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_merge_translators_strings.rb +93 -0
  73. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_tag_build.rb +44 -0
  74. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata.rb +40 -0
  75. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata_source.rb +81 -0
  76. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_release_notes.rb +56 -0
  77. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_validate_ci_build.rb +46 -0
  78. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/an_metadata_update_helper.rb +152 -0
  79. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_git_helper.rb +44 -0
  80. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb +359 -0
  81. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_version_helper.rb +475 -0
  82. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ci_helper.rb +91 -0
  83. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/configure_helper.rb +282 -0
  84. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/encryption_helper.rb +51 -0
  85. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/filesystem_helper.rb +93 -0
  86. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/git_helper.rb +224 -0
  87. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/github_helper.rb +135 -0
  88. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_adc_app_sizes_helper.rb +74 -0
  89. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_git_helper.rb +80 -0
  90. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_helper.rb +208 -0
  91. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_version_helper.rb +348 -0
  92. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_download_helper.rb +107 -0
  93. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_update_helper.rb +182 -0
  94. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/promo_screenshots_helper.rb +399 -0
  95. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/release_notes_helper.rb +21 -0
  96. data/lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb +40 -0
  97. data/lib/fastlane/plugin/wpmreleasetoolkit/models/file_reference.rb +86 -0
  98. data/lib/fastlane/plugin/wpmreleasetoolkit/version.rb +5 -0
  99. metadata +449 -0
@@ -0,0 +1,20 @@
1
+ # release-toolkit
2
+
3
+ The Actions in this library are organized in 4 folders:
4
+
5
+ ### Android
6
+
7
+ Actions in this folder automate some tasks of the WordPress for Android release process.
8
+
9
+ ### Common
10
+
11
+ Actions in this folder automate tasks that are common to both the iOS and Android release processes.
12
+ These actions are cross-platforms and usually related to integrating with GitHub, GlotPress and other services.
13
+
14
+ ### Configure
15
+
16
+ Actions in this folder support the creation, update and validation of the credentials file.
17
+
18
+ ### iOS
19
+
20
+ Actions in this folder automate some tasks of the WordPress for iOS release process.
@@ -0,0 +1,53 @@
1
+ require 'fastlane/action'
2
+ require_relative '../../helper/android/android_localize_helper'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ class AnLocalizeLibsAction < Action
7
+ def self.run(params)
8
+ main_strings_path = params[:app_strings_path]
9
+ libraries_strings_path = params[:libs_strings_path]
10
+
11
+ any_changes = false
12
+ libraries_strings_path.each do |lib|
13
+ (any_changes = Fastlane::Helper::Android::LocalizeHelper.merge_lib(main_strings_path, lib)) || any_changes
14
+ end
15
+
16
+ UI.message("Changes have been applied to #{main_strings_path}. Please, verify it!") if any_changes
17
+ end
18
+
19
+ def self.description
20
+ 'Merges the strings to be localised from the libs into the main application file'
21
+ end
22
+
23
+ def self.authors
24
+ ['Lorenzo Mattei']
25
+ end
26
+
27
+ def self.return_value
28
+ end
29
+
30
+ def self.details
31
+ 'Merges the strings to be localised from the libs into the main application file'
32
+ end
33
+
34
+ def self.available_options
35
+ [
36
+ FastlaneCore::ConfigItem.new(key: :app_strings_path,
37
+ description: 'The path of the main strings file',
38
+ optional: false,
39
+ is_string: true),
40
+ FastlaneCore::ConfigItem.new(key: :libs_strings_path,
41
+ env_name: 'LOCALIZE_LIBS_STRINGS_PATH',
42
+ description: 'The list of libs to merge',
43
+ optional: false,
44
+ is_string: false),
45
+ ]
46
+ end
47
+
48
+ def self.is_supported?(platform)
49
+ return platform == :android
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,171 @@
1
+ require 'fastlane/action'
2
+ require_relative '../../helper/an_metadata_update_helper.rb'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ class AnUpdateMetadataSourceAction < Action
7
+ def self.run(params)
8
+ # fastlane will take care of reading in the parameter and fetching the environment variable:
9
+ UI.message "Parameter .po file path: #{params[:po_file_path]}"
10
+ UI.message "Release version: #{params[:release_version]}"
11
+
12
+ # Init
13
+ create_block_parsers(params[:release_version], params[:source_files])
14
+
15
+ # Do
16
+ check_source_files(params[:source_files])
17
+ temp_po_name = create_temp_po(params)
18
+ swap_po(params[:po_file_path], temp_po_name)
19
+
20
+ UI.message "File #{params[:po_file_path]} updated!"
21
+ end
22
+
23
+ # Verifies that all the source files are available
24
+ # to this action
25
+ def self.check_source_files(source_files)
26
+ source_files.values.each do |file_path|
27
+ UI.user_error!("Couldn't find file at path '#{file_path}'") unless File.exist?(file_path)
28
+ end
29
+ end
30
+
31
+ # Creates a temp po file merging
32
+ # new data for known tags
33
+ # and the data already in the original
34
+ # .po fo the others.
35
+ def self.create_temp_po(params)
36
+ orig = params[:po_file_path]
37
+ target = self.create_target_file_path(orig)
38
+
39
+ # Clear if older exists
40
+ File.delete(target) if File.exist? target
41
+
42
+ # Create the new one
43
+ begin
44
+ File.open(target, 'a') do |fw|
45
+ File.open(orig, 'r').each do |fr|
46
+ write_target_block(fw, fr)
47
+ end
48
+ end
49
+ rescue
50
+ File.delete(target) if File.exist? target
51
+ raise
52
+ end
53
+
54
+ target
55
+ end
56
+
57
+ # Deletes the old po and moves the temp one
58
+ # to the final location
59
+ def self.swap_po(orig_file_path, temp_file_path)
60
+ File.delete(orig_file_path) if File.exist? orig_file_path
61
+ File.rename(temp_file_path, orig_file_path)
62
+ end
63
+
64
+ # Generates the temp file path
65
+ def self.create_target_file_path(orig_file_path)
66
+ "#{File.dirname(orig_file_path)}/#{File.basename(orig_file_path, '.*')}.tmp"
67
+ end
68
+
69
+ # Creates the block instances
70
+ def self.create_block_parsers(release_version, block_files)
71
+ @blocks = []
72
+
73
+ # Inits default handler
74
+ @blocks.push Fastlane::Helper::UnknownMetadataBlock.new
75
+
76
+ # Init special handlers
77
+ block_files.each do |key, file_path|
78
+ case key
79
+ when :release_note
80
+ @blocks.push Fastlane::Helper::ReleaseNoteMetadataBlock.new(key, file_path, release_version)
81
+ when :release_note_short
82
+ @blocks.push Fastlane::Helper::ReleaseNoteShortMetadataBlock.new(key, file_path, release_version)
83
+ else
84
+ @blocks.push Fastlane::Helper::StandardMetadataBlock.new(key, file_path)
85
+ end
86
+ end
87
+
88
+ # Sets the default
89
+ @current_block = @blocks[0]
90
+ end
91
+
92
+ # Manages tags depending on the type
93
+ def self.write_target_block(fw, line)
94
+ if is_block_id(line)
95
+ key = line.split(' ')[1].tr('\"', '')
96
+ @blocks.each do |block|
97
+ @current_block = block if block.is_handler_for(key)
98
+ end
99
+ end
100
+
101
+ @current_block = @blocks.first if is_comment(line)
102
+
103
+ @current_block.handle_line(fw, line)
104
+ end
105
+
106
+ def self.is_block_id(line)
107
+ line.start_with?('msgctxt')
108
+ end
109
+
110
+ def self.is_comment(line)
111
+ line.start_with?('#')
112
+ end
113
+
114
+ #####################################################
115
+ # @!group Documentation
116
+ #####################################################
117
+
118
+ def self.description
119
+ 'Updates a .po file with new data from .txt files'
120
+ end
121
+
122
+ def self.details
123
+ 'You can use this action to update the .po file that contains the string to load to GlotPress for localization.'
124
+ end
125
+
126
+ def self.available_options
127
+ # Define all options your action supports.
128
+
129
+ # Below a few examples
130
+ [
131
+ FastlaneCore::ConfigItem.new(key: :po_file_path,
132
+ env_name: 'FL_UPDATE_METADATA_SOURCE_PO_FILE_PATH',
133
+ description: 'The path of the .po file to update',
134
+ is_string: true,
135
+ verify_block: proc do |value|
136
+ UI.user_error!("No .po file path for UpdateMetadataSourceAction given, pass using `po_file_path: 'file path'`") unless value && (!value.empty?)
137
+ UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value)
138
+ end),
139
+ FastlaneCore::ConfigItem.new(key: :release_version,
140
+ env_name: 'FL_UPDATE_METADATA_SOURCE_RELEASE_VERSION',
141
+ description: 'The release version of the app (to use to mark the release notes)',
142
+ verify_block: proc do |value|
143
+ UI.user_error!("No relase version for UpdateMetadataSourceAction given, pass using `release_version: 'version'`") unless value && (!value.empty?)
144
+ end),
145
+ FastlaneCore::ConfigItem.new(key: :source_files,
146
+ env_name: 'FL_UPDATE_METADATA_SOURCE_SOURCE_FILES',
147
+ description: 'The hash with the path to the source files and the key to use to include their content',
148
+ is_string: false,
149
+ verify_block: proc do |value|
150
+ UI.user_error!("No source file hash for UpdateMetadataSourceAction given, pass using `source_files: 'source file hash'`") unless value && (!value.empty?)
151
+ end),
152
+ ]
153
+ end
154
+
155
+ def self.output
156
+ end
157
+
158
+ def self.return_value
159
+ # If your method provides a return value, you can describe here what it does
160
+ end
161
+
162
+ def self.authors
163
+ ['loremattei']
164
+ end
165
+
166
+ def self.is_supported?(platform)
167
+ [:android].include?(platform)
168
+ end
169
+ end
170
+ end
171
+ end
@@ -0,0 +1,63 @@
1
+ require 'fastlane/action'
2
+ require_relative '../../helper/android/android_localize_helper'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ class AnValidateLibStringsAction < Action
7
+ def self.run(params)
8
+ main_strings_path = params[:app_strings_path]
9
+ libraries_strings_path = params[:libs_strings_path]
10
+ diff_url = params[:diff_url]
11
+
12
+ source_diff = nil
13
+ if diff_url.nil? == false
14
+ data = open(params[:diff_url])
15
+ source_diff = data.read()
16
+ end
17
+
18
+ any_error = false
19
+ libraries_strings_path.each do |lib|
20
+ Fastlane::Helper::Android::LocalizeHelper.verify_lib(main_strings_path, lib, source_diff)
21
+ end
22
+ end
23
+
24
+ def self.description
25
+ 'Checks that the strings to be localised are updated from the libs into the main application file'
26
+ end
27
+
28
+ def self.authors
29
+ ['Lorenzo Mattei']
30
+ end
31
+
32
+ def self.return_value
33
+ end
34
+
35
+ def self.details
36
+ 'Checks that the strings to be localised are updated from the libs into the main application file'
37
+ end
38
+
39
+ def self.available_options
40
+ [
41
+ FastlaneCore::ConfigItem.new(key: :app_strings_path,
42
+ description: 'The path of the main strings file',
43
+ optional: false,
44
+ is_string: true),
45
+ FastlaneCore::ConfigItem.new(key: :libs_strings_path,
46
+ env_name: 'CHECK_LIBS_STRINGS_PATH',
47
+ description: 'The list of libs to merge',
48
+ optional: false,
49
+ is_string: false),
50
+ FastlaneCore::ConfigItem.new(key: :diff_url,
51
+ env_name: 'CHECK_LIBS_DIFF_URL',
52
+ description: 'The url of the diff to check',
53
+ optional: true,
54
+ is_string: true),
55
+ ]
56
+ end
57
+
58
+ def self.is_supported?(platform)
59
+ return platform == :android
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,103 @@
1
+ module Fastlane
2
+ module Actions
3
+ class AndroidBetabuildPrechecksAction < Action
4
+ def self.run(params)
5
+ UI.message "Skip confirm: #{params[:skip_confirm]}"
6
+ UI.message "Work on version: #{params[:base_version]}" unless params[:base_version].nil?
7
+
8
+ require_relative '../../helper/android/android_version_helper.rb'
9
+ require_relative '../../helper/android/android_git_helper.rb'
10
+
11
+ # Checkout develop and update
12
+ Fastlane::Helper::GitHelper.checkout_and_pull('develop')
13
+
14
+ # Check versions
15
+ release_version = Fastlane::Helper::Android::VersionHelper.get_release_version
16
+ message = "The following current version has been detected: #{release_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}\n"
17
+ alpha_release_version = Fastlane::Helper::Android::VersionHelper.get_alpha_version
18
+ message << "The following Alpha version has been detected: #{alpha_release_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}\n" unless alpha_release_version.nil?
19
+
20
+ # Check branch
21
+ app_version = Fastlane::Helper::Android::VersionHelper.get_public_version
22
+ UI.user_error!("#{message}Release branch for version #{app_version} doesn't exist. Abort.") unless !params[:base_version].nil? || Fastlane::Helper::GitHelper.checkout_and_pull(release: app_version)
23
+
24
+ # Check user overwrite
25
+ unless params[:base_version].nil?
26
+ overwrite_version = get_user_build_version(params[:base_version], message)
27
+ release_version = overwrite_version[0]
28
+ alpha_release_version = overwrite_version[1]
29
+ end
30
+
31
+ next_beta_version = Fastlane::Helper::Android::VersionHelper.calc_next_beta_version(release_version, alpha_release_version)
32
+ next_alpha_version = Fastlane::Helper::Android::VersionHelper.calc_next_alpha_version(next_beta_version, alpha_release_version) unless alpha_release_version.nil?
33
+
34
+ # Verify
35
+ message << "Updating branch to version: #{next_beta_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}(#{next_beta_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}) "
36
+ message << "and #{next_alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}(#{next_alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}).\n" unless alpha_release_version.nil?
37
+ if !params[:skip_confirm]
38
+ UI.user_error!('Aborted by user request') unless UI.confirm("#{message}Do you want to continue?")
39
+ else
40
+ UI.message(message)
41
+ end
42
+
43
+ # Check local repo status
44
+ other_action.ensure_git_status_clean()
45
+
46
+ # Return the current version
47
+ [next_beta_version, next_alpha_version]
48
+ end
49
+
50
+ def self.get_user_build_version(version, message)
51
+ UI.user_error!("Release branch for version #{version} doesn't exist. Abort.") unless Fastlane::Helper::GitHelper.checkout_and_pull(release: version)
52
+ release_version = Fastlane::Helper::Android::VersionHelper.get_release_version
53
+ message << "Looking at branch release/#{version} as requested by user. Detected version: #{release_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}.\n"
54
+ alpha_release_version = Fastlane::Helper::Android::VersionHelper.get_alpha_version
55
+ message << "and Alpha Version: #{alpha_release_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}\n" unless alpha_release_version.nil?
56
+ [release_version, alpha_release_version]
57
+ end
58
+
59
+ #####################################################
60
+ # @!group Documentation
61
+ #####################################################
62
+
63
+ def self.description
64
+ 'Runs some prechecks before preparing for a new test build'
65
+ end
66
+
67
+ def self.details
68
+ 'Updates the relevant release branch, checks the app version and ensure the branch is clean'
69
+ end
70
+
71
+ def self.available_options
72
+ [
73
+ FastlaneCore::ConfigItem.new(key: :base_version,
74
+ env_name: 'FL_ANDROID_BETABUILD_PRECHECKS_BASE_VERSION',
75
+ description: 'The version to work on', # a short description of this parameter
76
+ is_string: true,
77
+ optional: true), # true: verifies the input is a string, false: every kind of value),
78
+ FastlaneCore::ConfigItem.new(key: :skip_confirm,
79
+ env_name: 'FL_ANDROID_BETABUILD_PRECHECKS_SKIPCONFIRM',
80
+ description: 'Skips confirmation',
81
+ is_string: false, # true: verifies the input is a string, false: every kind of value
82
+ default_value: false), # the default value if the user didn't provide one
83
+ ]
84
+ end
85
+
86
+ def self.output
87
+ end
88
+
89
+ def self.return_value
90
+ # If you method provides a return value, you can describe here what it does
91
+ end
92
+
93
+ def self.authors
94
+ # So no one will ever forget your contribution to fastlane :) You are awesome btw!
95
+ ['loremattei']
96
+ end
97
+
98
+ def self.is_supported?(platform)
99
+ platform == :android
100
+ end
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,83 @@
1
+ module Fastlane
2
+ module Actions
3
+ class AndroidBuildPrechecksAction < Action
4
+ def self.run(params)
5
+ require_relative '../../helper/android/android_version_helper.rb'
6
+
7
+ UI.user_error!("Can't build beta and final at the same time!") if params[:final] && params[:beta]
8
+
9
+ Fastlane::Helper::GitHelper.ensure_on_branch!('release') unless other_action.is_ci()
10
+
11
+ message = ''
12
+ beta_version = Fastlane::Helper::Android::VersionHelper.get_release_version() unless !params[:beta] && !params[:final]
13
+ alpha_version = Fastlane::Helper::Android::VersionHelper.get_alpha_version() if params[:alpha]
14
+
15
+ UI.user_error!("Can't build a final release out of this branch because it's configured as a beta release!") if params[:final] && Fastlane::Helper::Android::VersionHelper.is_beta_version?(beta_version)
16
+
17
+ message << "Building version #{beta_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}(#{beta_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}) (for upload to Release Channel)\n" if params[:final]
18
+ message << "Building version #{beta_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}(#{beta_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}) (for upload to Beta Channel)\n" if params[:beta]
19
+ message << "Building version #{alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]}(#{alpha_version[Fastlane::Helper::Android::VersionHelper::VERSION_CODE]}) (for upload to Alpha Channel)\n" if params[:alpha]
20
+
21
+ if !params[:skip_confirm]
22
+ UI.user_error!('Aborted by user request') unless UI.confirm("#{message}Do you want to continue?")
23
+ else
24
+ UI.message(message)
25
+ end
26
+
27
+ # Check local repo status
28
+ other_action.ensure_git_status_clean() unless other_action.is_ci()
29
+ end
30
+
31
+ #####################################################
32
+ # @!group Documentation
33
+ #####################################################
34
+
35
+ def self.description
36
+ 'Runs some prechecks before the build'
37
+ end
38
+
39
+ def self.details
40
+ 'Runs some prechecks before the build'
41
+ end
42
+
43
+ def self.available_options
44
+ [
45
+ FastlaneCore::ConfigItem.new(key: :skip_confirm,
46
+ env_name: 'FL_ANDROID_BUILD_PRECHECKS_SKIP_CONFIRM',
47
+ description: 'True to avoid the system ask for confirmation',
48
+ is_string: false,
49
+ default_value: false),
50
+ FastlaneCore::ConfigItem.new(key: :alpha,
51
+ env_name: 'FL_ANDROID_BUILD_PRECHECKS_ALPHA_BUILD',
52
+ description: 'True if this is for an alpha build',
53
+ is_string: false,
54
+ default_value: false),
55
+ FastlaneCore::ConfigItem.new(key: :beta,
56
+ env_name: 'FL_ANDROID_BUILD_PRECHECKS_BETA_BUILD',
57
+ description: 'True if this is for a beta build',
58
+ is_string: false,
59
+ default_value: false),
60
+ FastlaneCore::ConfigItem.new(key: :final,
61
+ env_name: 'FL_ANDROID_BUILD_PRECHECKS_FINAL_BUILD',
62
+ description: 'True if this is for a final build',
63
+ is_string: false,
64
+ default_value: false),
65
+ ]
66
+ end
67
+
68
+ def self.output
69
+ end
70
+
71
+ def self.return_value
72
+ end
73
+
74
+ def self.authors
75
+ ['loremattei']
76
+ end
77
+
78
+ def self.is_supported?(platform)
79
+ platform == :android
80
+ end
81
+ end
82
+ end
83
+ end