fastlane-plugin-wpmreleasetoolkit 8.1.0 → 9.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_update_metadata_source_action.rb +6 -4
  3. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_validate_lib_strings_action.rb +1 -1
  4. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_betabuild_prechecks.rb +1 -1
  5. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_build_prechecks.rb +2 -2
  6. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_beta.rb +1 -1
  7. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_final_release.rb +1 -1
  8. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_hotfix.rb +3 -2
  9. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_release.rb +1 -1
  10. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_codefreeze_prechecks.rb +3 -3
  11. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_completecodefreeze_prechecks.rb +4 -4
  12. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_file_by_version.rb +1 -1
  13. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_translations_action.rb +1 -1
  14. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_finalize_prechecks.rb +1 -1
  15. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_firebase_test.rb +1 -1
  16. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_hotfix_prechecks.rb +1 -1
  17. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_trigger_build_action.rb +1 -1
  18. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/check_translation_progress.rb +1 -1
  19. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_new_milestone_action.rb +1 -1
  20. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_release_action.rb +4 -3
  21. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/extract_release_notes_for_version_action.rb +3 -3
  22. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/find_previous_tag.rb +58 -0
  23. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/get_prs_between_tags.rb +112 -0
  24. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_downloadmetadata_action.rb +5 -5
  25. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_update_metadata_source.rb +6 -4
  26. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/promo_screenshots_action.rb +24 -24
  27. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/upload_to_s3.rb +37 -5
  28. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_add_files_to_copy_action.rb +3 -3
  29. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_download_action.rb +3 -3
  30. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_update_action.rb +2 -2
  31. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_validate_action.rb +3 -3
  32. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_development_certificates_to_provisioning_profiles.rb +2 -2
  33. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_devices_to_provisioning_profiles.rb +2 -2
  34. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_betabuild_prechecks.rb +1 -1
  35. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_build_prechecks.rb +4 -4
  36. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_build_preflight.rb +1 -1
  37. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_beta.rb +5 -7
  38. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_hotfix.rb +3 -22
  39. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_release.rb +6 -20
  40. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_codefreeze_prechecks.rb +1 -1
  41. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_completecodefreeze_prechecks.rb +1 -1
  42. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_finalize_prechecks.rb +1 -1
  43. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_app_version.rb +11 -4
  44. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_hotfix_prechecks.rb +1 -1
  45. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_lint_localizations.rb +2 -2
  46. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_tag_build.rb +2 -2
  47. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata_source.rb +4 -4
  48. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_validate_ci_build.rb +2 -2
  49. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb +39 -41
  50. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_version_helper.rb +10 -11
  51. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/configure_helper.rb +1 -1
  52. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/git_helper.rb +1 -1
  53. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/github_helper.rb +39 -1
  54. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_adc_app_sizes_helper.rb +2 -2
  55. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_git_helper.rb +2 -55
  56. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_linter_helper.rb +3 -3
  57. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_version_helper.rb +42 -52
  58. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata/metadata_block.rb +20 -0
  59. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata/release_note_metadata_block.rb +72 -0
  60. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata/release_note_short_metadata_block.rb +23 -0
  61. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata/standard_metadata_block.rb +47 -0
  62. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata/unknown_metadata_block.rb +13 -0
  63. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata/whats_new_metadata_block.rb +53 -0
  64. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_download_helper.rb +13 -13
  65. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/promo_screenshots_helper.rb +11 -11
  66. data/lib/fastlane/plugin/wpmreleasetoolkit/version.rb +3 -1
  67. metadata +32 -15
  68. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/get_prs_list_action.rb +0 -66
  69. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_localize_project.rb +0 -43
  70. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata.rb +0 -40
  71. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/an_metadata_update_helper.rb +0 -152
  72. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_update_helper.rb +0 -182
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 800ea2231ea5727ef5d9f529e38802b18b947bfd124d5a904c5ee9eef29cf389
4
- data.tar.gz: 742331639d6749c92bc2303d0a8303fc790a90517c46262410f259b99ea174fe
3
+ metadata.gz: 982e123d25f4bc8ee55dfc605e8e6873c0365d4d75f4eabce7884a4de01649e4
4
+ data.tar.gz: 462ba969f7790d6aabf6201e5bae1e4df4ac0512c8ef42955247a3319e891827
5
5
  SHA512:
6
- metadata.gz: d7017d051cea5a6be3a734dbba0ad1b0e8d7f3bb372aa0b62af9bc113546fbbcb429c24c48e8edbeae28d80f502c5886ab891c696415772731e4123a5f3a1cc3
7
- data.tar.gz: 5f4c26332afb18a947df9368ba9efc1f9508db854c0270fd84e5a12125c31f2bc89695b6311efb5e3cd6047a54b7c73efe8da5288cc5bd334461c85952db871a
6
+ metadata.gz: 10433f33f1af9890023113464a26c5ff5ed29df4388f11248d6afb5cd85bc83622d4511c4f8e4279cde75fbcaa0605f6487aee6267042fcdd897c3a0036404f6
7
+ data.tar.gz: ce0e3fc971589f2f5a750c23e2acf78ae4bba2637d133717d361ee3bc5778e6f37b5d3f1f2455c9a9024454e7f443d3ce27b5c034eea41de61aed72e422532ab
@@ -1,5 +1,7 @@
1
1
  require 'fastlane/action'
2
- require_relative '../../helper/an_metadata_update_helper'
2
+ require_relative '../../helper/metadata/release_note_metadata_block'
3
+ require_relative '../../helper/metadata/release_note_short_metadata_block'
4
+ require_relative '../../helper/metadata/whats_new_metadata_block'
3
5
 
4
6
  module Fastlane
5
7
  module Actions
@@ -133,21 +135,21 @@ module Fastlane
133
135
  description: 'The path of the .po file to update',
134
136
  type: String,
135
137
  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?)
138
+ UI.user_error!("No .po file path for UpdateMetadataSourceAction given, pass using `po_file_path: 'file path'`") unless value && !value.empty?
137
139
  UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value)
138
140
  end),
139
141
  FastlaneCore::ConfigItem.new(key: :release_version,
140
142
  env_name: 'FL_UPDATE_METADATA_SOURCE_RELEASE_VERSION',
141
143
  description: 'The release version of the app (to use to mark the release notes)',
142
144
  verify_block: proc do |value|
143
- UI.user_error!("No relase version for UpdateMetadataSourceAction given, pass using `release_version: 'version'`") unless value && (!value.empty?)
145
+ UI.user_error!("No relase version for UpdateMetadataSourceAction given, pass using `release_version: 'version'`") unless value && !value.empty?
144
146
  end),
145
147
  FastlaneCore::ConfigItem.new(key: :source_files,
146
148
  env_name: 'FL_UPDATE_METADATA_SOURCE_SOURCE_FILES',
147
149
  description: 'The hash with the path to the source files and the key to use to include their content',
148
150
  type: Hash,
149
151
  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?)
152
+ UI.user_error!("No source file hash for UpdateMetadataSourceAction given, pass using `source_files: 'source file hash'`") unless value && !value.empty?
151
153
  end),
152
154
  ]
153
155
  end
@@ -12,7 +12,7 @@ module Fastlane
12
12
  source_diff = nil
13
13
  if diff_url.nil? == false
14
14
  data = open(params[:diff_url])
15
- source_diff = data.read()
15
+ source_diff = data.read
16
16
  end
17
17
 
18
18
  any_error = false
@@ -42,7 +42,7 @@ module Fastlane
42
42
  end
43
43
 
44
44
  # Check local repo status
45
- other_action.ensure_git_status_clean()
45
+ other_action.ensure_git_status_clean
46
46
 
47
47
  # Return the current version
48
48
  [next_beta_version, next_alpha_version]
@@ -7,7 +7,7 @@ module Fastlane
7
7
 
8
8
  UI.user_error!("Can't build beta and final at the same time!") if params[:final] && params[:beta]
9
9
 
10
- Fastlane::Helper::GitHelper.ensure_on_branch!('release') unless other_action.is_ci()
10
+ Fastlane::Helper::GitHelper.ensure_on_branch!('release') unless other_action.is_ci
11
11
 
12
12
  message = ''
13
13
  beta_version = Fastlane::Helper::Android::VersionHelper.get_release_version unless !params[:beta] && !params[:final]
@@ -26,7 +26,7 @@ module Fastlane
26
26
  end
27
27
 
28
28
  # Check local repo status
29
- other_action.ensure_git_status_clean() unless other_action.is_ci()
29
+ other_action.ensure_git_status_clean unless other_action.is_ci
30
30
  end
31
31
 
32
32
  #####################################################
@@ -25,7 +25,7 @@ module Fastlane
25
25
  Fastlane::Helper::Android::VersionHelper.update_versions(new_version_beta, new_version_alpha)
26
26
  UI.message 'Done!'
27
27
 
28
- Fastlane::Helper::Android::GitHelper.commit_version_bump()
28
+ Fastlane::Helper::Android::GitHelper.commit_version_bump
29
29
  end
30
30
 
31
31
  #####################################################
@@ -23,7 +23,7 @@ module Fastlane
23
23
  Fastlane::Helper::Android::VersionHelper.update_versions(final_version, current_version_alpha)
24
24
  UI.message 'Done!'
25
25
 
26
- Fastlane::Helper::Android::GitHelper.commit_version_bump()
26
+ Fastlane::Helper::Android::GitHelper.commit_version_bump
27
27
  end
28
28
 
29
29
  #####################################################
@@ -21,7 +21,7 @@ module Fastlane
21
21
  Fastlane::Helper::Android::VersionHelper.update_versions(new_version, nil)
22
22
  UI.message 'Done!'
23
23
 
24
- Fastlane::Helper::Android::GitHelper.commit_version_bump()
24
+ Fastlane::Helper::Android::GitHelper.commit_version_bump
25
25
 
26
26
  UI.message 'Done.'
27
27
  end
@@ -46,7 +46,8 @@ module Fastlane
46
46
  type: String),
47
47
  FastlaneCore::ConfigItem.new(key: :version_code,
48
48
  env_name: 'FL_ANDROID_BUMP_VERSION_HOTFIX_CODE',
49
- description: 'The version code for the hotfix'),
49
+ description: 'The version code for the hotfix',
50
+ type: Integer),
50
51
  FastlaneCore::ConfigItem.new(key: :previous_version_name,
51
52
  env_name: 'FL_ANDROID_BUMP_VERSION_HOTFIX_PREVIOUS_VERSION',
52
53
  description: 'The version to branch from',
@@ -36,7 +36,7 @@ module Fastlane
36
36
 
37
37
  UI.message 'Updating app version...'
38
38
  Fastlane::Helper::Android::VersionHelper.update_versions(new_version_beta, new_version_alpha)
39
- Fastlane::Helper::Android::GitHelper.commit_version_bump()
39
+ Fastlane::Helper::Android::GitHelper.commit_version_bump
40
40
  UI.message 'Done.'
41
41
  end
42
42
 
@@ -1,8 +1,8 @@
1
1
  module Fastlane
2
2
  module Actions
3
3
  class AndroidCodefreezePrechecksAction < Action
4
- VERSION_RELEASE = 'release'
5
- VERSION_ALPHA = 'alpha'
4
+ VERSION_RELEASE = 'release'.freeze
5
+ VERSION_ALPHA = 'alpha'.freeze
6
6
 
7
7
  def self.run(params)
8
8
  # fastlane will take care of reading in the parameter and fetching the environment variable:
@@ -33,7 +33,7 @@ module Fastlane
33
33
  end
34
34
 
35
35
  # Check local repo status
36
- other_action.ensure_git_status_clean()
36
+ other_action.ensure_git_status_clean
37
37
 
38
38
  # Return the current version
39
39
  Fastlane::Helper::Android::VersionHelper.get_public_version
@@ -13,14 +13,14 @@ module Fastlane
13
13
 
14
14
  version = Fastlane::Helper::Android::VersionHelper.get_public_version
15
15
  message = "Completing code freeze for: #{version}\n"
16
- unless params[:skip_confirm]
17
- UI.user_error!('Aborted by user request') unless UI.confirm("#{message}Do you want to continue?")
18
- else
16
+ if params[:skip_confirm]
19
17
  UI.message(message)
18
+ else
19
+ UI.user_error!('Aborted by user request') unless UI.confirm("#{message}Do you want to continue?")
20
20
  end
21
21
 
22
22
  # Check local repo status
23
- other_action.ensure_git_status_clean()
23
+ other_action.ensure_git_status_clean
24
24
 
25
25
  version
26
26
  end
@@ -53,7 +53,7 @@ module Fastlane
53
53
  description: 'The download folder',
54
54
  type: String,
55
55
  optional: true,
56
- default_value: Dir.tmpdir()),
56
+ default_value: Dir.tmpdir),
57
57
  FastlaneCore::ConfigItem.new(key: :github_release_prefix,
58
58
  description: 'The prefix which is used in the GitHub release title',
59
59
  type: String,
@@ -22,7 +22,7 @@ module Fastlane
22
22
 
23
23
  # Update submodules then lint translations
24
24
  unless params[:lint_task].nil? || params[:lint_task].empty?
25
- Fastlane::Helper::GitHelper.update_submodules()
25
+ Fastlane::Helper::GitHelper.update_submodules
26
26
  Action.sh('./gradlew', params[:lint_task])
27
27
  end
28
28
 
@@ -24,7 +24,7 @@ module Fastlane
24
24
  end
25
25
 
26
26
  # Check local repo status
27
- other_action.ensure_git_status_clean()
27
+ other_action.ensure_git_status_clean
28
28
 
29
29
  version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]
30
30
  end
@@ -16,7 +16,7 @@ module Fastlane
16
16
 
17
17
  # Log in to Firebase (and validate credentials)
18
18
  run_uuid = params[:test_run_id] || SecureRandom.uuid
19
- test_dir = params[:results_output_dir] || File.join(Dir.tmpdir(), run_uuid)
19
+ test_dir = params[:results_output_dir] || File.join(Dir.tmpdir, run_uuid)
20
20
 
21
21
  # Set up the log file and output directory
22
22
  FileUtils.mkdir_p(test_dir)
@@ -28,7 +28,7 @@ module Fastlane
28
28
  UI.crash!("Version #{prev_ver} is not tagged! Can't branch. Abort!") unless other_action.git_tag_exists(tag: prev_ver)
29
29
 
30
30
  # Check local repo status
31
- other_action.ensure_git_status_clean()
31
+ other_action.ensure_git_status_clean
32
32
 
33
33
  # Return the current version
34
34
  prev_ver
@@ -28,7 +28,7 @@ module Fastlane
28
28
  )
29
29
 
30
30
  if response.state == 'scheduled'
31
- UI.message("Successfully scheduled new build. You can see it at '#{response.web_url}'")
31
+ UI.success("Successfully scheduled new build. You can see it at '#{response.web_url}'")
32
32
  else
33
33
  UI.crash!("Failed to start job\nError: [#{response}]")
34
34
  end
@@ -113,7 +113,7 @@ module Fastlane
113
113
  type: Array,
114
114
  optional: true,
115
115
  # Default to Mag16.
116
- default_value: 'ar de es fr he id it ja ko nl pt-br ru sv tr zh-cn zh-tw'.split()),
116
+ default_value: 'ar de es fr he id it ja ko nl pt-br ru sv tr zh-cn zh-tw'.split),
117
117
  FastlaneCore::ConfigItem.new(key: :min_acceptable_translation_percentage,
118
118
  env_name: 'FL_CHECK_TRANSLATION_PROGRESS_MIN_ACCEPTABLE_TRANSLATION_PERCENTAGE',
119
119
  description: 'The threshold under which an error is raised',
@@ -16,7 +16,7 @@ module Fastlane
16
16
 
17
17
  milestone_duedate = last_stone[:due_on]
18
18
  milestone_duration = params[:milestone_duration]
19
- newmilestone_duedate = (milestone_duedate.to_datetime.next_day(milestone_duration).to_time).utc
19
+ newmilestone_duedate = milestone_duedate.to_datetime.next_day(milestone_duration).to_time.utc
20
20
  newmilestone_number = Fastlane::Helper::Ios::VersionHelper.calc_next_release_version(last_stone[:title])
21
21
  number_of_days_from_code_freeze_to_release = params[:number_of_days_from_code_freeze_to_release]
22
22
  # Because of the app stores review process, we submit the binary 3 days before the intended release date.
@@ -23,7 +23,7 @@ module Fastlane
23
23
  end
24
24
 
25
25
  github_helper = Fastlane::Helper::GithubHelper.new(github_token: params[:github_token])
26
- github_helper.create_release(
26
+ url = github_helper.create_release(
27
27
  repository: repository,
28
28
  version: version,
29
29
  target: params[:target],
@@ -32,7 +32,8 @@ module Fastlane
32
32
  prerelease: prerelease,
33
33
  is_draft: is_draft
34
34
  )
35
- UI.message('Done')
35
+ UI.success("Successfully created GitHub Release. You can see it at '#{url}'")
36
+ url
36
37
  end
37
38
 
38
39
  def self.description
@@ -44,7 +45,7 @@ module Fastlane
44
45
  end
45
46
 
46
47
  def self.return_value
47
- # If your method provides a return value, you can describe here what it does
48
+ 'The URL of the created GitHub Release'
48
49
  end
49
50
 
50
51
  def self.details
@@ -15,7 +15,7 @@ module Fastlane
15
15
  end
16
16
 
17
17
  unless extracted_notes_file.nil?
18
- extracted_notes_file.close()
18
+ extracted_notes_file.close
19
19
  check_and_commit_extracted_notes_file(extracted_notes_file_path, version)
20
20
  end
21
21
  end
@@ -25,9 +25,9 @@ module Fastlane
25
25
  File.open(release_notes_file_path).each do |line|
26
26
  case state
27
27
  when :discarding
28
- state = :evaluating if (line.match(/^(\d+\.)?(\d+\.)?(\*|\d+)$/)) && (line.strip() == version)
28
+ state = :evaluating if line.match(/^(\d+\.)?(\d+\.)?(\*|\d+)$/) && (line.strip == version)
29
29
  when :evaluating
30
- state = (line.match(/-/)) ? :extracting : :discarding
30
+ state = line.match(/-/) ? :extracting : :discarding
31
31
  when :extracting
32
32
  if line.match(/^(\d+\.)?(\d+\.)?(\*|\d+)$/)
33
33
  state = :discarding
@@ -0,0 +1,58 @@
1
+ require 'fastlane/action'
2
+ require_relative '../../helper/github_helper'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ class FindPreviousTagAction < Action
7
+ def self.run(params)
8
+ tag_pattern = params[:pattern]
9
+
10
+ # Make sure we have all the latest tags fetched locally
11
+ Actions.sh('git', 'fetch', '--tags', '--force') { nil }
12
+ # Check if the current commit has a tag, so we can exclude it and not risk returning the current commit tag instead of really-previous one
13
+ current_commit_tag = Actions.sh('git describe --tags --exact-match 2>/dev/null || true').chomp
14
+
15
+ # Finally find the previous tag matching the provided pattern, and that is not the current commit
16
+ git_cmd = %w[git describe --tags --abbrev=0]
17
+ git_cmd += ['--match', tag_pattern] unless tag_pattern.nil?
18
+ git_cmd += ['--exclude', current_commit_tag] unless current_commit_tag.empty?
19
+ Actions.sh(*git_cmd) { |exit_status, stdout, _| exit_status.success? ? stdout.chomp : nil }
20
+ end
21
+
22
+ def self.description
23
+ 'Use `git describe` to find the previous tag matching a specific pattern'
24
+ end
25
+
26
+ def self.authors
27
+ ['Automattic']
28
+ end
29
+
30
+ def self.return_value
31
+ 'The name of the previous tag matching the pattern, or nil if none was found'
32
+ end
33
+
34
+ def self.details
35
+ <<~DETAILS
36
+ Uses `git describe --tags --abbrev=0 --match … --exclude …` to find the previous git tag
37
+ reachable from the current commit and that matches a specific naming pattern
38
+
39
+ e.g. `find_previous_tag(pattern: '12.3.*.*')`, `find_previous_tag(pattern: '12.3-rc-*')`
40
+ DETAILS
41
+ end
42
+
43
+ def self.available_options
44
+ [
45
+ FastlaneCore::ConfigItem.new(key: :pattern,
46
+ description: 'The _fnmatch_-style pattern to use when searching for the previous tag',
47
+ optional: true,
48
+ default_value: nil,
49
+ type: String),
50
+ ]
51
+ end
52
+
53
+ def self.is_supported?(platform)
54
+ true
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,112 @@
1
+ require 'fastlane/action'
2
+ require_relative '../../helper/github_helper'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ class GetPrsBetweenTagsAction < Action
7
+ def self.run(params)
8
+ repository = params[:repository]
9
+ tag_name = params[:tag_name]
10
+ target_commitish = params[:target_commitish]
11
+ previous_tag = params[:previous_tag]
12
+ config_file_path = params[:configuration_file_path]
13
+ gh_token = params[:github_token]
14
+
15
+ # Get commit list
16
+ github_helper = Fastlane::Helper::GithubHelper.new(github_token: gh_token)
17
+ changelog = begin
18
+ github_helper.generate_release_notes(
19
+ repository: repository,
20
+ tag_name: tag_name,
21
+ previous_tag: previous_tag,
22
+ target_commitish: target_commitish,
23
+ config_file_path: config_file_path
24
+ )
25
+ rescue StandardError => e
26
+ error_msg = "❌ Error computing the list of PRs since #{previous_tag || 'last release'}: `#{e.message}`"
27
+ UI.important(error_msg)
28
+ error_msg # Use error message as GitHub Release body to help us be aware of what went wrong.
29
+ end
30
+
31
+ previous_release_link = if previous_tag.nil?
32
+ 'last release'
33
+ else
34
+ link = github_helper.get_release_url(repository: repository, tag_name: previous_tag)
35
+ "[#{previous_tag}](#{link})"
36
+ end
37
+ changelog
38
+ .gsub("## What's Changed", "## New PRs since #{previous_release_link}\n")
39
+ end
40
+
41
+ def self.description
42
+ 'Gets a markdown text containing the list of PRs that have been merged between two git tags'
43
+ end
44
+
45
+ def self.authors
46
+ ['Automattic']
47
+ end
48
+
49
+ def self.return_value
50
+ 'The markdown-formatted string listing the PRs between the provided tags'
51
+ end
52
+
53
+ def self.details
54
+ <<~DETAILS
55
+ Uses the GitHub API to get a generated changelog consisting of the list of PRs that have been merged between two git tags.
56
+ The list of PRs can optionally be categorized using a config file (typically living at `.github/release.yml`)
57
+
58
+ This is typically useful to generate a CHANGELOG-style list of PRs for a given build since a last build. For example:
59
+
60
+ - List PRs between current beta that we just built (e.g. 12.3-rc-4) and the previous beta of the same version:
61
+ git_prs_between_tags(tag_name: '12.3-rc-4', previous_tag: '12.3-rc-3')
62
+ - List all PRs that landed since the last stable/final release:
63
+ git_prs_between_tags(tag_name: '12.3-rc-4', previous_tag: '12.2')
64
+
65
+ Tip: You can use the `find_previous_tag` action to help you find the previous_tag matching an expected pattern (like `12.3-rc-*`)
66
+
67
+ See https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#generate-release-notes-content-for-a-release
68
+ DETAILS
69
+ end
70
+
71
+ def self.available_options
72
+ [
73
+ FastlaneCore::ConfigItem.new(key: :repository,
74
+ env_names: %w[GIT_REPO_SLUG BUILDKITE_REPO],
75
+ description: 'The repository name, including the organization (e.g. `wordpress-mobile/wordpress-ios`)',
76
+ optional: false,
77
+ default_value_dynamic: true,
78
+ type: String),
79
+ FastlaneCore::ConfigItem.new(key: :tag_name,
80
+ description: 'The name of the tag for the release we are about to create. This can be an existing tag or a new one',
81
+ optional: false,
82
+ type: String),
83
+ FastlaneCore::ConfigItem.new(key: :target_commitish,
84
+ description: 'Specifies the commitish value that will be the target for the release\'s tag. ' \
85
+ 'Required if the supplied `tag_name` does not reference an existing tag. Ignored if the tag_name already exists. ' \
86
+ 'Defaults to the commit sha of the current HEAD',
87
+ optional: true,
88
+ default_value: `git rev-parse HEAD`.chomp,
89
+ default_value_dynamic: true,
90
+ type: String),
91
+ FastlaneCore::ConfigItem.new(key: :previous_tag,
92
+ description: 'The name of the previous tag to use as the starting point for the release notes. ' \
93
+ 'If not provided explicitly, GitHub will use the last tag as the starting point',
94
+ optional: true,
95
+ type: String),
96
+ FastlaneCore::ConfigItem.new(key: :configuration_file_path,
97
+ description: 'Path to a file in the repository containing configuration settings used for generating the release notes. ' \
98
+ 'If unspecified, the configuration file located in the repository at `.github/release.yml` or `.github/release.yaml` will be used. ' \
99
+ 'If that is not present, the default configuration will be used. ' \
100
+ 'See https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes#configuration-options',
101
+ optional: true,
102
+ type: String),
103
+ Fastlane::Helper::GithubHelper.github_token_config_item,
104
+ ]
105
+ end
106
+
107
+ def self.is_supported?(platform)
108
+ true
109
+ end
110
+ end
111
+ end
112
+ end
@@ -25,11 +25,11 @@ module Fastlane
25
25
  downloader.download(loc[1], complete_url, loc[1] == params[:source_locale])
26
26
  end
27
27
 
28
- if loc.is_a?(String)
29
- UI.message "Downloading language: #{loc}"
30
- complete_url = "#{params[:project_url]}#{loc}/default/export-translations/?filters[status]=current&format=json"
31
- downloader.download(loc, complete_url, loc == params[:source_locale])
32
- end
28
+ next unless loc.is_a?(String)
29
+
30
+ UI.message "Downloading language: #{loc}"
31
+ complete_url = "#{params[:project_url]}#{loc}/default/export-translations/?filters[status]=current&format=json"
32
+ downloader.download(loc, complete_url, loc == params[:source_locale])
33
33
  end
34
34
  end
35
35
 
@@ -1,4 +1,6 @@
1
- require_relative '../../helper/metadata_update_helper'
1
+ require_relative '../../helper/metadata/release_note_metadata_block'
2
+ require_relative '../../helper/metadata/release_note_short_metadata_block'
3
+ require_relative '../../helper/metadata/whats_new_metadata_block'
2
4
 
3
5
  module Fastlane
4
6
  module Actions
@@ -132,21 +134,21 @@ module Fastlane
132
134
  description: 'The path of the .po file to update',
133
135
  type: String,
134
136
  verify_block: proc do |value|
135
- 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!("No .po file path for UpdateMetadataSourceAction given, pass using `po_file_path: 'file path'`") unless value && !value.empty?
136
138
  UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value)
137
139
  end),
138
140
  FastlaneCore::ConfigItem.new(key: :release_version,
139
141
  env_name: 'FL_UPDATE_METADATA_SOURCE_RELEASE_VERSION',
140
142
  description: 'The release version of the app (to use to mark the release notes)',
141
143
  verify_block: proc do |value|
142
- UI.user_error!("No relase version for UpdateMetadataSourceAction given, pass using `release_version: 'version'`") unless value && (!value.empty?)
144
+ UI.user_error!("No relase version for UpdateMetadataSourceAction given, pass using `release_version: 'version'`") unless value && !value.empty?
143
145
  end),
144
146
  FastlaneCore::ConfigItem.new(key: :source_files,
145
147
  env_name: 'FL_UPDATE_METADATA_SOURCE_SOURCE_FILES',
146
148
  description: 'The hash with the path to the source files and the key to use to include their content',
147
149
  type: Hash,
148
150
  verify_block: proc do |value|
149
- UI.user_error!("No source file hash for UpdateMetadataSourceAction given, pass using `source_files: 'source file hash'`") unless value && (!value.empty?)
151
+ UI.user_error!("No source file hash for UpdateMetadataSourceAction given, pass using `source_files: 'source file hash'`") unless value && !value.empty?
150
152
  end),
151
153
  ]
152
154
  end
@@ -15,28 +15,28 @@ module Fastlane
15
15
 
16
16
  helper.check_fonts_installed!(config: config) unless params[:skip_font_check]
17
17
 
18
- translationDirectories = subdirectories_for_path(params[:metadata_folder])
19
- imageDirectories = subdirectories_for_path(params[:orig_folder])
18
+ translation_directories = subdirectories_for_path(params[:metadata_folder])
19
+ image_directories = subdirectories_for_path(params[:orig_folder])
20
20
 
21
- unless helper.can_resolve_path(params[:output_folder])
21
+ if helper.can_resolve_path(params[:output_folder])
22
+ UI.message "#{self.check_path(params[:output_folder])} Output Folder: #{params[:output_folder]}"
23
+ else
22
24
  UI.message "✅ Created Output Folder: #{params[:output_folder]}"
23
25
  FileUtils.mkdir_p(params[:output_folder])
24
- else
25
- UI.message "#{self.check_path(params[:output_folder])} Output Folder: #{params[:output_folder]}"
26
26
  end
27
27
 
28
- outputDirectory = helper.resolve_path(params[:output_folder])
28
+ output_directory = helper.resolve_path(params[:output_folder])
29
29
 
30
30
  ## If there are no translated screenshot images (whether it's because they haven't been generated yet,
31
31
  ## or because we aren't using them), just use the translated directories.
32
- languages = if imageDirectories == []
33
- translationDirectories
32
+ languages = if image_directories == []
33
+ translation_directories
34
34
  ## And vice-versa.
35
- elsif translationDirectories == []
36
- imageDirectories
35
+ elsif translation_directories == []
36
+ image_directories
37
37
  ## If there are original screenshots and translations available, use only locales that exist in both.
38
38
  else
39
- imageDirectories & translationDirectories
39
+ image_directories & translation_directories
40
40
  end
41
41
 
42
42
  UI.message("💙 Creating Promo Screenshots for: #{languages.join(', ')}")
@@ -49,7 +49,7 @@ module Fastlane
49
49
 
50
50
  stylesheet_path = config['stylesheet']
51
51
 
52
- entries = build_entries(config['entries'], languages, outputDirectory, params)
52
+ entries = build_entries(config['entries'], languages, output_directory, params)
53
53
 
54
54
  bar = ProgressBar.new(entries.count, :bar, :counter, :eta, :rate)
55
55
 
@@ -183,32 +183,32 @@ module Fastlane
183
183
  config_entries
184
184
  .flat_map do |entry|
185
185
  languages.map do |language|
186
- newEntry = entry.deep_dup
186
+ new_entry = entry.deep_dup
187
187
 
188
188
  # Not every output file will have a screenshot, so handle cases where no
189
189
  # screenshot file is defined
190
190
  if !entry['screenshot'].nil? && !entry['filename'].nil?
191
- newEntry['screenshot'] = helper.resolve_path(params[:orig_folder]) + language + entry['screenshot']
192
- newEntry['filename'] = output_directory + language + entry['filename']
191
+ new_entry['screenshot'] = helper.resolve_path(params[:orig_folder]) + language + entry['screenshot']
192
+ new_entry['filename'] = output_directory + language + entry['filename']
193
193
  elsif !entry['screenshot'].nil? && entry['filename'].nil?
194
- newEntry['screenshot'] = helper.resolve_path(params[:orig_folder]) + language + entry['screenshot']
195
- newEntry['filename'] = output_directory + language + entry['screenshot']
194
+ new_entry['screenshot'] = helper.resolve_path(params[:orig_folder]) + language + entry['screenshot']
195
+ new_entry['filename'] = output_directory + language + entry['screenshot']
196
196
  elsif entry['screenshot'].nil? && !entry['filename'].nil?
197
- newEntry['filename'] = output_directory + language + entry['filename']
197
+ new_entry['filename'] = output_directory + language + entry['filename']
198
198
  else
199
- puts newEntry
199
+ puts new_entry
200
200
  abort 'Unable to find output file names'
201
201
  end
202
202
 
203
- newEntry['locale'] = language
203
+ new_entry['locale'] = language
204
204
 
205
205
  # Localize file paths for text
206
- newEntry['text'].sub!('{locale}', language.dup) unless entry['text'].nil?
206
+ new_entry['text'].sub!('{locale}', language.dup) unless entry['text'].nil?
207
207
 
208
208
  # Map attachments paths to their localized versions
209
- newEntry['attachments'] = [] if newEntry['attachments'].nil?
209
+ new_entry['attachments'] = [] if new_entry['attachments'].nil?
210
210
 
211
- newEntry['attachments'].each do |attachment|
211
+ new_entry['attachments'].each do |attachment|
212
212
  ## If there are no translated screenshot images (whether it's because they haven't been generated yet,
213
213
  ## or because we aren't using them), just use the translated directories.
214
214
  ## And vice-versa.
@@ -240,7 +240,7 @@ module Fastlane
240
240
  attachment['text']&.sub!('{locale}', language.dup)
241
241
  end
242
242
 
243
- newEntry
243
+ new_entry
244
244
  end
245
245
  end
246
246
  .sort do |x, y|