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,139 @@
1
+ require 'fastlane/action'
2
+ require 'fastlane_core/ui/ui'
3
+
4
+ require_relative '../../helper/filesystem_helper'
5
+ require_relative '../../helper/configure_helper'
6
+
7
+ module Fastlane
8
+ module Actions
9
+ class ConfigureUpdateAction < Action
10
+ def self.run(params = {})
11
+ prompt_to_switch_branches
12
+
13
+ if repo_is_ahead_of_remote
14
+ UI.user_error!("The local secrets store has changes that the remote repository doesn't.\
15
+ Please fix this issue before continuing")
16
+ end
17
+
18
+ prompt_to_update_to_most_recent_version if repo_is_behind_remote
19
+
20
+ if configure_file_is_behind_repo
21
+ prompt_to_update_configure_file_to_most_recent_hash
22
+ else
23
+ # Update configure file even if already update to date
24
+ # This ensures the file format is up to date
25
+ update_configure_file
26
+ end
27
+
28
+ # If there is no encryption key for the project, generate one
29
+ if Fastlane::Helper::ConfigureHelper.project_encryption_key.nil?
30
+ # If the user chose not to update the repo but there is no encryption key, throw an error
31
+ UI.user_error!('The local secrets behind the remote but it is missing a keys.json entry for this project. Please update it to the latest commit.') if repo_is_behind_remote
32
+ Fastlane::Helper::ConfigureHelper.update_project_encryption_key
33
+ # Update the configure file to the new hash
34
+ update_configure_file
35
+ end
36
+
37
+ Fastlane::Helper::ConfigureHelper.files_to_copy.each do |file_reference|
38
+ file_reference.update
39
+ end
40
+
41
+ UI.success "Configuration Secrets are up to date – don't forget to commit your changes to `.configure`."
42
+
43
+ # Apply the changes that are now in the .configure file
44
+ other_action.configure_apply
45
+ end
46
+
47
+ def self.prompt_to_switch_branches
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?")
50
+ new_branch = UI.select("Select the branch you'd like to switch to: ", get_branches)
51
+ checkout_branch(new_branch)
52
+ update_configure_file
53
+ else
54
+ UI.user_error!('The local secrets store is in a deatched HEAD state. Please check out a branch and try again.') if current_branch.nil?
55
+ end
56
+ end
57
+
58
+ def self.prompt_to_update_to_most_recent_version
59
+ if UI.confirm("The current branch is #{repo_commits_behind_remote} commit(s) behind. Would you like to update it?")
60
+ update_branch
61
+ update_configure_file
62
+ end
63
+ end
64
+
65
+ def self.prompt_to_update_configure_file_to_most_recent_hash
66
+ update_configure_file if UI.confirm("The `.configure` file is #{configure_file_commits_behind_repo} commit hash(es) behind the repo. Would you like to update it?")
67
+ end
68
+
69
+ def self.current_branch
70
+ Fastlane::Helper::ConfigureHelper.repo_branch_name
71
+ end
72
+
73
+ def self.current_hash
74
+ Fastlane::Helper::ConfigureHelper.repo_commit_hash
75
+ end
76
+
77
+ def self.update_configure_file
78
+ Fastlane::Helper::ConfigureHelper.update_configure_file_from_repository
79
+ end
80
+
81
+ def self.repo_is_ahead_of_remote
82
+ Fastlane::Helper::ConfigureHelper.repo_is_ahead_of_remote
83
+ end
84
+
85
+ def self.repo_commits_behind_remote
86
+ Fastlane::Helper::ConfigureHelper.repo_commits_behind_remote
87
+ end
88
+
89
+ def self.repo_is_behind_remote
90
+ Fastlane::Helper::ConfigureHelper.repo_is_behind_remote
91
+ end
92
+
93
+ def self.configure_file_is_behind_repo
94
+ Fastlane::Helper::ConfigureHelper.configure_file_is_behind_local
95
+ end
96
+
97
+ def self.configure_file_commits_behind_repo
98
+ Fastlane::Helper::ConfigureHelper.configure_file_commits_behind_repo
99
+ end
100
+
101
+ def self.get_branches
102
+ branches = sh("cd #{absolute_secret_store_path} && git branch -r")
103
+ branches.split("\n")
104
+ .map { |s| s.strip!.split('/')[1] }
105
+ .reject { |s| s.include? 'HEAD' }
106
+ end
107
+
108
+ ### Switch to the given branch, but don't ensure that it's up-to-date – that's for another step
109
+ def self.checkout_branch(branch_name)
110
+ sh("cd '#{absolute_secret_store_path}' && git checkout '#{branch_name}'")
111
+ end
112
+
113
+ ### Ensure that the local secrets respository is up to date
114
+ def self.update_branch
115
+ sh("cd '#{absolute_secret_store_path}' && git pull")
116
+ end
117
+
118
+ def self.absolute_secret_store_path
119
+ Fastlane::Helper::FilesystemHelper.secret_store_dir
120
+ end
121
+
122
+ def self.description
123
+ 'Ensure that the local secrets repository is up to date.'
124
+ end
125
+
126
+ def self.authors
127
+ ['Jeremy Massel']
128
+ end
129
+
130
+ def self.details
131
+ 'Ensure that the local secrets repository is up to date, and lets you test alternative branches.'
132
+ end
133
+
134
+ def self.is_supported?(platform)
135
+ true
136
+ end
137
+ end
138
+ end
139
+ end
@@ -0,0 +1,134 @@
1
+ require 'fastlane/action'
2
+ require 'fastlane_core/ui/ui'
3
+
4
+ require_relative '../../helper/filesystem_helper'
5
+ require_relative '../../helper/configure_helper'
6
+
7
+ module Fastlane
8
+ module Actions
9
+ class ConfigureValidateAction < Action
10
+ def self.run(params = {})
11
+ # Start by ensuring that we've set up the project for configuration
12
+ validate_that_configure_file_exists
13
+
14
+ # Check that the secrets repo is locally clean _before_ downloading the latest version,
15
+ # otherwise, the error messaging isn't as helpful.
16
+ validate_that_secrets_repo_is_clean
17
+
18
+ # Update the repository to get the latest version of the configuration secrets – that's
19
+ # how we'll know if we're behind in subsequent validations
20
+ ConfigureDownloadAction.run
21
+
22
+ validate_that_branches_match
23
+
24
+ validate_that_hashes_match
25
+
26
+ validate_that_no_dependent_files_have_changed
27
+
28
+ validate_that_all_copied_files_match
29
+
30
+ UI.success 'Configuration is valid'
31
+ end
32
+
33
+ ###
34
+ # VALIDATION RULES
35
+ ###
36
+
37
+ ### Validate that the branch specified in .configure matches the branch
38
+ ### checked out in ~/.mobile-secrets.
39
+ def self.validate_that_branches_match
40
+ repo_branch_name = Fastlane::Helper::ConfigureHelper.repo_branch_name
41
+ file_branch_name = Fastlane::Helper::ConfigureHelper.configure_file_branch_name
42
+
43
+ unless repo_branch_name == file_branch_name
44
+
45
+ UI.user_error!([
46
+ 'The branch specified in `.configure` is not the currently checked out branch in the secrets repository.',
47
+ "To fix this issue, switch back to the `#{file_branch_name}` branch in the mobile secrets repository.",
48
+ ].join("\n"))
49
+ end
50
+ end
51
+
52
+ ### Validate that the pinned hash specified in .configure matches
53
+ ### the current hash of ~/.mobile-secrets
54
+ def self.validate_that_hashes_match
55
+ repo_hash = Fastlane::Helper::ConfigureHelper.repo_commit_hash
56
+ file_hash = Fastlane::Helper::ConfigureHelper.configure_file_commit_hash
57
+
58
+ unless repo_hash == file_hash
59
+
60
+ UI.user_error!([
61
+ 'The pinned_hash specified in `.configure` is not the currently checked out hash in the secrets repository.',
62
+ "To fix this issue, check out the `#{file_hash}` hash in the mobile secrets repository.",
63
+ ].join("\n"))
64
+ end
65
+ end
66
+
67
+ ### Validate that based on the commit hash in the .configure file, no files have changed
68
+ ### that affect this project.
69
+ def self.validate_that_no_dependent_files_have_changed
70
+ repo_hash = Fastlane::Helper::ConfigureHelper.repo_commit_hash
71
+ file_hash = Fastlane::Helper::ConfigureHelper.configure_file_commit_hash
72
+
73
+ changed_files = Fastlane::Helper::ConfigureHelper.files_changed_between(file_hash, repo_hash)
74
+ dependencies = Fastlane::Helper::ConfigureHelper.file_dependencies
75
+ new_files = Fastlane::Helper::ConfigureHelper.new_files_in(changed_files)
76
+
77
+ changed_dependencies = changed_files & dependencies # calculate array intersection
78
+
79
+ UI.user_error!("The following files are out of date. Please run `bundle exec fastlane run configure_update` before continuing:\n\n#{changed_dependencies}") unless changed_dependencies.empty?
80
+
81
+ UI.user_error!("The following files are in the secrets repository, but aren't available for your project. Please run `bundle exec fastlane run configure_update` before continuing:\n\n#{new_files}") unless new_files.empty?
82
+ end
83
+
84
+ ### Validate that the secrets repo doesn't have any local changes
85
+ def self.validate_that_secrets_repo_is_clean
86
+ UI.user_error!('The secrets repository has uncommitted changes. Please commit or discard them before continuing.') unless Fastlane::Helper::ConfigureHelper.repo_has_changes
87
+ end
88
+
89
+ def self.validate_that_all_copied_files_match
90
+ Fastlane::Helper::ConfigureHelper.files_to_copy.each do |x|
91
+ source = absolute_secret_store_path(x.file)
92
+ destination = absolute_project_path(x.destination)
93
+
94
+ sourceHash = file_hash(source)
95
+ destinationHash = file_hash(destination)
96
+
97
+ UI.user_error!("`#{x.destination} doesn't match the file in the secrets repository (#{x.file}) – unable to continue") unless sourceHash == destinationHash
98
+ end
99
+ end
100
+
101
+ def self.validate_that_configure_file_exists
102
+ UI.user_error!("Couldn't find `.configure` file. Please set up this project for `configure` by running `bundle exec fastlane run configure_setup`") unless Fastlane::Helper::ConfigureHelper.configuration_path_exists
103
+ end
104
+
105
+ def self.absolute_project_path(relative_path)
106
+ Fastlane::Helper::FilesystemHelper.absolute_project_path(relative_path)
107
+ end
108
+
109
+ def self.absolute_secret_store_path(relative_path)
110
+ Fastlane::Helper::FilesystemHelper.absolute_secret_store_path(relative_path)
111
+ end
112
+
113
+ def self.file_hash(absolute_path)
114
+ Fastlane::Helper::FilesystemHelper.file_hash(absolute_path)
115
+ end
116
+
117
+ def self.description
118
+ 'Ensure that the configuration is valid'
119
+ end
120
+
121
+ def self.authors
122
+ ['Jeremy Massel']
123
+ end
124
+
125
+ def self.details
126
+ 'Ensure that the configuration is valid'
127
+ end
128
+
129
+ def self.is_supported?(platform)
130
+ true
131
+ end
132
+ end
133
+ end
134
+ end
@@ -0,0 +1,77 @@
1
+ module Fastlane
2
+ module Actions
3
+ class AddDevelopmentCertificatesToProvisioningProfilesAction < Action
4
+ def self.run(params)
5
+ require 'spaceship'
6
+
7
+ Spaceship.login
8
+ Spaceship.select_team(team_id: params[:team_id])
9
+
10
+ all_certificates = Spaceship.certificate.all(mac: false).select do |certificate|
11
+ certificate.owner_type == 'teamMember'
12
+ end
13
+
14
+ params[:app_identifier].each do |identifier|
15
+ Spaceship.provisioning_profile.find_by_bundle_id(bundle_id: identifier)
16
+ .select do |profile|
17
+ profile.is_a? Spaceship::Portal::ProvisioningProfile::Development
18
+ end
19
+ .tap do |profiles|
20
+ UI.important "Warning: Unable to find any profiles associated with #{identifier}" unless profiles.length > 0
21
+ end
22
+ .each do |profile|
23
+ profile.certificates = all_certificates
24
+ profile.update!
25
+ UI.success "Applied #{all_certificates.length} certificates to #{profile.name}"
26
+ end
27
+ end
28
+ end
29
+
30
+ #####################################################
31
+ # @!group Documentation
32
+ #####################################################
33
+
34
+ def self.description
35
+ 'Add dev certificates to provisioning profiles'
36
+ end
37
+
38
+ def self.details
39
+ "Add all team member's development certificates to profiles associated with the provided bundle identifiers"
40
+ end
41
+
42
+ def self.available_options
43
+ [
44
+ FastlaneCore::ConfigItem.new(key: :app_identifier,
45
+ description: 'List of App Identifiers that should contain the new device identifier',
46
+ is_string: false,
47
+ verify_block: proc do |value|
48
+ UI.user_error!('You must provide an array of bundle identifiers in `app_identifier`') if value.empty?
49
+ end),
50
+ FastlaneCore::ConfigItem.new(key: :team_id,
51
+ description: 'The team_id for the provisioning profiles',
52
+ is_string: true,
53
+ verify_block: proc do |value|
54
+ UI.user_error!('You must provide a team ID in `team_id`') unless value && (!value.empty?)
55
+ end),
56
+ ]
57
+ end
58
+
59
+ def self.output
60
+ # This lane doesn't provide variables that other lanes can consume.
61
+ end
62
+
63
+ def self.return_value
64
+ # If your method provides a return value, you can describe here what it does
65
+ end
66
+
67
+ def self.authors
68
+ # So no one will ever forget your contribution to fastlane :) You are awesome btw!
69
+ ['jkmassel']
70
+ end
71
+
72
+ def self.is_supported?(platform)
73
+ platform == :ios
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,79 @@
1
+ module Fastlane
2
+ module Actions
3
+ class AddAllDevicesToProvisioningProfilesAction < Action
4
+ def self.run(params)
5
+ require 'spaceship'
6
+
7
+ Spaceship.login
8
+ Spaceship.select_team(team_id: params[:team_id])
9
+
10
+ devices = Spaceship.device.all_ios_profile_devices
11
+
12
+ params[:app_identifier].each do |identifier|
13
+ Spaceship.provisioning_profile.find_by_bundle_id(bundle_id: identifier)
14
+ .select do |profile|
15
+ profile.is_a? Spaceship::Portal::ProvisioningProfile::Development
16
+ end
17
+ .tap do |profiles|
18
+ UI.important "Warning: Unable to find any profiles associated with #{identifier}" unless profiles.length > 0
19
+ end
20
+ .each do |profile|
21
+ profile.devices = devices
22
+ profile.update!
23
+ UI.success "Applied #{devices.length} devices to #{profile.name}"
24
+ end
25
+ end
26
+ end
27
+
28
+ #####################################################
29
+ # @!group Documentation
30
+ #####################################################
31
+
32
+ def self.description
33
+ 'Add devices to provisioning profiles'
34
+ end
35
+
36
+ def self.details
37
+ 'Add all iOS devices to any profiles associated with the provided bundle identifiers'
38
+ end
39
+
40
+ def self.available_options
41
+ [
42
+ FastlaneCore::ConfigItem.new(
43
+ key: :app_identifier,
44
+ description: 'List of App Identifiers that should contain the new device identifier',
45
+ is_string: false,
46
+ verify_block: proc do |value|
47
+ UI.user_error!('You must provide an array of bundle identifiers in `app_identifier`') if value.empty?
48
+ end
49
+ ),
50
+ FastlaneCore::ConfigItem.new(
51
+ key: :team_id,
52
+ description: 'The team_id for the provisioning profiles',
53
+ is_string: true,
54
+ verify_block: proc do |value|
55
+ UI.user_error!('You must provide a team ID in `team_id`') unless value && (!value.empty?)
56
+ end
57
+ ),
58
+ ]
59
+ end
60
+
61
+ def self.output
62
+ # This lane doesn't provide variables that other lanes can consume.
63
+ end
64
+
65
+ def self.return_value
66
+ # If your method provides a return value, you can describe here what it does
67
+ end
68
+
69
+ def self.authors
70
+ # So no one will ever forget your contribution to fastlane :) You are awesome btw!
71
+ ['jkmassel']
72
+ end
73
+
74
+ def self.is_supported?(platform)
75
+ platform == :ios
76
+ end
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,92 @@
1
+ module Fastlane
2
+ module Actions
3
+ class IosBetabuildPrechecksAction < 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/ios/ios_version_helper.rb'
9
+ require_relative '../../helper/ios/ios_git_helper.rb'
10
+
11
+ # Checkout develop and update
12
+ Fastlane::Helper::GitHelper.checkout_and_pull('develop')
13
+
14
+ # Check versions
15
+ build_version = Fastlane::Helper::Ios::VersionHelper.get_build_version
16
+ message = "The following current version has been detected: #{build_version}\n"
17
+
18
+ # Check branch
19
+ app_version = Fastlane::Helper::Ios::VersionHelper.get_public_version
20
+ 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)
21
+
22
+ # Check user overwrite
23
+ build_version = get_user_build_version(params[:base_version], message) unless params[:base_version].nil?
24
+ next_version = Fastlane::Helper::Ios::VersionHelper.calc_next_build_version(build_version)
25
+
26
+ # Verify
27
+ message << "Updating branch to version: #{next_version}.\n"
28
+ if !params[:skip_confirm]
29
+ UI.user_error!('Aborted by user request') unless UI.confirm("#{message}Do you want to continue?")
30
+ else
31
+ UI.message(message)
32
+ end
33
+
34
+ # Check local repo status
35
+ other_action.ensure_git_status_clean()
36
+
37
+ # Return the current version
38
+ build_version
39
+ end
40
+
41
+ def self.get_user_build_version(version, message)
42
+ UI.user_error!("Release branch for version #{version} doesn't exist. Abort.") unless Fastlane::Helper::GitHelper.checkout_and_pull(release: version)
43
+ build_version = Fastlane::Helper::Ios::VersionHelper.get_build_version
44
+ message << "Looking at branch release/#{version} as requested by user. Detected version: #{build_version}.\n"
45
+ build_version
46
+ end
47
+
48
+ #####################################################
49
+ # @!group Documentation
50
+ #####################################################
51
+
52
+ def self.description
53
+ 'Runs some prechecks before preparing for a new test build'
54
+ end
55
+
56
+ def self.details
57
+ 'Updates the relevant release branch, checks the app version and ensure the branch is clean'
58
+ end
59
+
60
+ def self.available_options
61
+ [
62
+ FastlaneCore::ConfigItem.new(key: :base_version,
63
+ env_name: 'FL_IOS_BETABUILD_PRECHECKS_BASE_VERSION',
64
+ description: 'The version to work on', # a short description of this parameter
65
+ is_string: true,
66
+ optional: true), # true: verifies the input is a string, false: every kind of value),
67
+ FastlaneCore::ConfigItem.new(key: :skip_confirm,
68
+ env_name: 'FL_IOS_BETABUILD_PRECHECKS_SKIPCONFIRM',
69
+ description: 'Skips confirmation',
70
+ is_string: false, # true: verifies the input is a string, false: every kind of value
71
+ default_value: false), # the default value if the user didn't provide one
72
+ ]
73
+ end
74
+
75
+ def self.output
76
+ end
77
+
78
+ def self.return_value
79
+ # If you method provides a return value, you can describe here what it does
80
+ end
81
+
82
+ def self.authors
83
+ # So no one will ever forget your contribution to fastlane :) You are awesome btw!
84
+ ['loremattei']
85
+ end
86
+
87
+ def self.is_supported?(platform)
88
+ platform == :ios
89
+ end
90
+ end
91
+ end
92
+ end