fastlane 2.175.0 → 2.180.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +95 -82
  4. data/cert/lib/cert/options.rb +1 -0
  5. data/cert/lib/cert/runner.rb +5 -1
  6. data/deliver/lib/deliver/app_screenshot.rb +6 -2
  7. data/deliver/lib/deliver/download_screenshots.rb +1 -2
  8. data/deliver/lib/deliver/options.rb +1 -0
  9. data/deliver/lib/deliver/runner.rb +12 -4
  10. data/deliver/lib/deliver/setup.rb +0 -1
  11. data/deliver/lib/deliver/upload_metadata.rb +5 -4
  12. data/deliver/lib/deliver/upload_screenshots.rb +10 -10
  13. data/fastlane/lib/fastlane/actions/app_store_build_number.rb +6 -1
  14. data/fastlane/lib/fastlane/actions/app_store_connect_api_key.rb +8 -5
  15. data/fastlane/lib/fastlane/actions/appaloosa.rb +7 -2
  16. data/fastlane/lib/fastlane/actions/backup_file.rb +1 -1
  17. data/fastlane/lib/fastlane/actions/build_app.rb +4 -0
  18. data/fastlane/lib/fastlane/actions/check_app_store_metadata.rb +4 -0
  19. data/fastlane/lib/fastlane/actions/commit_github_file.rb +11 -1
  20. data/fastlane/lib/fastlane/actions/create_xcframework.rb +5 -0
  21. data/fastlane/lib/fastlane/actions/docs/upload_to_play_store.md +2 -1
  22. data/fastlane/lib/fastlane/actions/get_github_release.rb +11 -1
  23. data/fastlane/lib/fastlane/actions/get_provisioning_profile.rb +4 -0
  24. data/fastlane/lib/fastlane/actions/get_version_number.rb +17 -10
  25. data/fastlane/lib/fastlane/actions/git_branch.rb +4 -10
  26. data/fastlane/lib/fastlane/actions/git_tag_exists.rb +4 -0
  27. data/fastlane/lib/fastlane/actions/github_api.rb +2 -1
  28. data/fastlane/lib/fastlane/actions/increment_build_number.rb +8 -1
  29. data/fastlane/lib/fastlane/actions/install_provisioning_profile.rb +4 -0
  30. data/fastlane/lib/fastlane/actions/jazzy.rb +10 -1
  31. data/fastlane/lib/fastlane/actions/jira.rb +61 -14
  32. data/fastlane/lib/fastlane/actions/latest_testflight_build_number.rb +1 -0
  33. data/fastlane/lib/fastlane/actions/match_nuke.rb +59 -0
  34. data/fastlane/lib/fastlane/actions/notarize.rb +98 -51
  35. data/fastlane/lib/fastlane/actions/push_to_git_remote.rb +0 -1
  36. data/fastlane/lib/fastlane/actions/register_device.rb +1 -1
  37. data/fastlane/lib/fastlane/actions/register_devices.rb +1 -1
  38. data/fastlane/lib/fastlane/actions/restore_file.rb +1 -1
  39. data/fastlane/lib/fastlane/actions/set_changelog.rb +1 -1
  40. data/fastlane/lib/fastlane/actions/sourcedocs.rb +164 -0
  41. data/fastlane/lib/fastlane/actions/spaceship_logs.rb +1 -1
  42. data/fastlane/lib/fastlane/actions/update_project_provisioning.rb +1 -2
  43. data/fastlane/lib/fastlane/actions/upload_symbols_to_crashlytics.rb +4 -5
  44. data/fastlane/lib/fastlane/actions/upload_to_testflight.rb +5 -1
  45. data/fastlane/lib/fastlane/erb_template_helper.rb +7 -1
  46. data/fastlane/lib/fastlane/fast_file.rb +9 -5
  47. data/fastlane/lib/fastlane/helper/git_helper.rb +11 -7
  48. data/fastlane/lib/fastlane/plugins/plugin_fetcher.rb +1 -2
  49. data/fastlane/lib/fastlane/plugins/plugin_info_collector.rb +1 -2
  50. data/fastlane/lib/fastlane/plugins/plugin_manager.rb +1 -2
  51. data/fastlane/lib/fastlane/setup/setup.rb +23 -10
  52. data/fastlane/lib/fastlane/swift_fastlane_function.rb +4 -0
  53. data/fastlane/lib/fastlane/swift_runner_upgrader.rb +2 -0
  54. data/fastlane/lib/fastlane/version.rb +1 -1
  55. data/fastlane/swift/Deliverfile.swift +1 -1
  56. data/fastlane/swift/DeliverfileProtocol.swift +3 -3
  57. data/fastlane/swift/Fastlane.swift +574 -332
  58. data/fastlane/swift/Gymfile.swift +1 -1
  59. data/fastlane/swift/GymfileProtocol.swift +1 -1
  60. data/fastlane/swift/LaneFileProtocol.swift +9 -3
  61. data/fastlane/swift/Matchfile.swift +1 -1
  62. data/fastlane/swift/MatchfileProtocol.swift +1 -1
  63. data/fastlane/swift/Precheckfile.swift +1 -1
  64. data/fastlane/swift/PrecheckfileProtocol.swift +3 -3
  65. data/fastlane/swift/RubyCommand.swift +1 -1
  66. data/fastlane/swift/Scanfile.swift +1 -1
  67. data/fastlane/swift/ScanfileProtocol.swift +13 -1
  68. data/fastlane/swift/Screengrabfile.swift +1 -1
  69. data/fastlane/swift/ScreengrabfileProtocol.swift +1 -1
  70. data/fastlane/swift/Snapshotfile.swift +1 -1
  71. data/fastlane/swift/SnapshotfileProtocol.swift +1 -1
  72. data/fastlane/swift/SocketClient.swift +2 -1
  73. data/fastlane/swift/SocketResponse.swift +4 -2
  74. data/fastlane/swift/formatting/Brewfile.lock.json +12 -12
  75. data/fastlane_core/lib/fastlane_core.rb +1 -0
  76. data/fastlane_core/lib/fastlane_core/configuration/configuration.rb +5 -3
  77. data/fastlane_core/lib/fastlane_core/helper.rb +24 -1
  78. data/fastlane_core/lib/fastlane_core/ipa_upload_package_builder.rb +3 -2
  79. data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +14 -8
  80. data/fastlane_core/lib/fastlane_core/pkg_upload_package_builder.rb +3 -2
  81. data/fastlane_core/lib/fastlane_core/project.rb +3 -14
  82. data/{deliver/lib/deliver → fastlane_core/lib/fastlane_core}/queue_worker.rb +4 -4
  83. data/fastlane_core/lib/fastlane_core/ui/implementations/shell.rb +12 -1
  84. data/fastlane_core/lib/fastlane_core/ui/interface.rb +1 -1
  85. data/gym/lib/gym/generators/.package_command_generator_xcode7.rb.swp +0 -0
  86. data/gym/lib/gym/generators/package_command_generator.rb +4 -0
  87. data/gym/lib/gym/generators/package_command_generator_xcode7.rb +13 -8
  88. data/gym/lib/gym/runner.rb +11 -4
  89. data/match/lib/match/change_password.rb +3 -3
  90. data/match/lib/match/encryption/interface.rb +1 -1
  91. data/match/lib/match/encryption/openssl.rb +2 -2
  92. data/match/lib/match/importer.rb +1 -1
  93. data/match/lib/match/migrate.rb +1 -1
  94. data/match/lib/match/module.rb +1 -0
  95. data/match/lib/match/nuke.rb +1 -1
  96. data/match/lib/match/runner.rb +1 -1
  97. data/match/lib/match/storage/google_cloud_storage.rb +1 -1
  98. data/match/lib/match/storage/s3_storage.rb +1 -1
  99. data/pilot/lib/pilot/build_manager.rb +25 -8
  100. data/pilot/lib/pilot/manager.rb +5 -1
  101. data/pilot/lib/pilot/options.rb +4 -3
  102. data/precheck/lib/precheck/options.rb +1 -0
  103. data/precheck/lib/precheck/runner.rb +6 -2
  104. data/scan/lib/scan/detect_values.rb +4 -1
  105. data/scan/lib/scan/options.rb +20 -5
  106. data/scan/lib/scan/runner.rb +79 -1
  107. data/scan/lib/scan/test_command_generator.rb +8 -8
  108. data/screengrab/lib/screengrab/android_environment.rb +6 -4
  109. data/screengrab/lib/screengrab/runner.rb +2 -3
  110. data/sigh/lib/sigh/download_all.rb +1 -1
  111. data/sigh/lib/sigh/options.rb +1 -0
  112. data/sigh/lib/sigh/runner.rb +5 -1
  113. data/snapshot/lib/assets/SnapshotHelper.swift +1 -1
  114. data/snapshot/lib/snapshot/simulator_launchers/simulator_launcher_base.rb +2 -1
  115. data/spaceship/lib/spaceship/client.rb +18 -17
  116. data/spaceship/lib/spaceship/connect_api/api_client.rb +24 -6
  117. data/spaceship/lib/spaceship/connect_api/models/app.rb +1 -1
  118. data/spaceship/lib/spaceship/connect_api/models/app_preview_set.rb +5 -0
  119. data/spaceship/lib/spaceship/connect_api/models/app_screenshot.rb +1 -1
  120. data/spaceship/lib/spaceship/connect_api/models/app_screenshot_set.rb +5 -0
  121. data/spaceship/lib/spaceship/connect_api/models/app_store_version_localization.rb +6 -0
  122. data/spaceship/lib/spaceship/connect_api/models/beta_group.rb +5 -0
  123. data/spaceship/lib/spaceship/connect_api/models/build.rb +5 -0
  124. data/spaceship/lib/spaceship/connect_api/models/build_beta_detail.rb +4 -0
  125. data/spaceship/lib/spaceship/connect_api/models/user_invitation.rb +13 -0
  126. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +13 -0
  127. data/spaceship/lib/spaceship/connect_api/token.rb +8 -2
  128. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +15 -0
  129. data/spaceship/lib/spaceship/two_step_or_factor_client.rb +41 -28
  130. metadata +26 -21
@@ -32,6 +32,10 @@ module Fastlane
32
32
  UI.message("Using App Store Connect API token...")
33
33
  Spaceship::ConnectAPI.token = token
34
34
  else
35
+ # Username is now optional since addition of App Store Connect API Key
36
+ # Force asking for username to prompt user if not already set
37
+ params.fetch(:username, force_ask: true)
38
+
35
39
  UI.message("Login to App Store Connect (#{params[:username]})")
36
40
  Spaceship::ConnectAPI.login(params[:username], use_portal: false, use_tunes: true, tunes_team_id: params[:team_id], team_name: params[:team_name])
37
41
  UI.message("Login successful")
@@ -100,7 +104,7 @@ module Fastlane
100
104
 
101
105
  def self.api_token(params)
102
106
  params[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
103
- api_token ||= Spaceship::ConnectAPI::Token.create(params[:api_key]) if params[:api_key]
107
+ api_token ||= Spaceship::ConnectAPI::Token.create(**params[:api_key]) if params[:api_key]
104
108
  api_token ||= Spaceship::ConnectAPI::Token.from_json_file(params[:api_key_path]) if params[:api_key_path]
105
109
  return api_token
106
110
  end
@@ -147,6 +151,7 @@ module Fastlane
147
151
  short_option: "-u",
148
152
  env_name: "ITUNESCONNECT_USER",
149
153
  description: "Your Apple ID Username",
154
+ optional: true,
150
155
  default_value: user,
151
156
  default_value_dynamic: true),
152
157
  FastlaneCore::ConfigItem.new(key: :team_id,
@@ -29,7 +29,7 @@ module Fastlane
29
29
  key = {
30
30
  key_id: key_id,
31
31
  issuer_id: issuer_id,
32
- key: key_content || File.binread(key_filepath),
32
+ key: key_content || File.binread(File.expand_path(key_filepath)),
33
33
  is_key_content_base64: is_key_content_base64,
34
34
  duration: duration,
35
35
  in_house: in_house
@@ -58,7 +58,7 @@ module Fastlane
58
58
  optional: true,
59
59
  conflicting_options: [:key_content],
60
60
  verify_block: proc do |value|
61
- UI.user_error!("Couldn't find key p8 file at path '#{value}'") unless File.exist?(value)
61
+ UI.user_error!("Couldn't find key p8 file at path '#{value}'") unless File.exist?(File.expand_path(value))
62
62
  end),
63
63
  FastlaneCore::ConfigItem.new(key: :key_content,
64
64
  env_name: "APP_STORE_CONNECT_API_KEY_KEY",
@@ -76,10 +76,13 @@ module Fastlane
76
76
  description: "The token session duration",
77
77
  optional: true,
78
78
  default_value: Spaceship::ConnectAPI::Token::MAX_TOKEN_DURATION,
79
- type: Integer),
79
+ type: Integer,
80
+ verify_block: proc do |value|
81
+ UI.user_error!("The duration can't be more than 1200 (20 minutes) and the value entered was '#{value}'") unless value <= 1200
82
+ end),
80
83
  FastlaneCore::ConfigItem.new(key: :in_house,
81
84
  env_name: "APP_STORE_CONNECT_API_KEY_IN_HOUSE",
82
- description: "Is App Store or Enterprise (in house) team? App Store Connect API cannot not determine this on its own (yet)",
85
+ description: "Is App Store or Enterprise (in house) team? App Store Connect API cannot determine this on its own (yet)",
83
86
  optional: true,
84
87
  type: Boolean)
85
88
  ]
@@ -96,7 +99,7 @@ module Fastlane
96
99
  end
97
100
 
98
101
  def self.is_supported?(platform)
99
- true
102
+ [:ios, :mac, :tvos].include?(platform)
100
103
  end
101
104
 
102
105
  def self.details
@@ -10,7 +10,7 @@ module Fastlane
10
10
  binary_url = get_binary_link(binary, api_key, store_id, params[:group_ids])
11
11
  return if binary_url.nil?
12
12
  screenshots_url = get_screenshots_links(api_key, store_id, params[:screenshots], params[:locale], params[:device])
13
- upload_on_appaloosa(api_key, store_id, binary_url, screenshots_url, params[:group_ids], params[:description])
13
+ upload_on_appaloosa(api_key, store_id, binary_url, screenshots_url, params[:group_ids], params[:description], params[:changelog])
14
14
  end
15
15
 
16
16
  def self.get_binary_link(binary, api_key, store_id, group_ids)
@@ -101,7 +101,7 @@ module Fastlane
101
101
  end.compact
102
102
  end
103
103
 
104
- def self.upload_on_appaloosa(api_key, store_id, binary_path, screenshots, group_ids, description)
104
+ def self.upload_on_appaloosa(api_key, store_id, binary_path, screenshots, group_ids, description, changelog)
105
105
  screenshots = all_screenshots_links(screenshots)
106
106
  uri = URI("#{APPALOOSA_SERVER}/#{store_id}/mobile_application_updates/upload")
107
107
  http = Net::HTTP.new(uri.host, uri.port)
@@ -111,6 +111,7 @@ module Fastlane
111
111
  api_key: api_key,
112
112
  mobile_application_update: {
113
113
  description: description,
114
+ changelog: changelog,
114
115
  binary_path: binary_path,
115
116
  screenshot1: screenshots[0],
116
117
  screenshot2: screenshots[1],
@@ -218,6 +219,10 @@ module Fastlane
218
219
  FastlaneCore::ConfigItem.new(key: :description,
219
220
  env_name: 'FL_APPALOOSA_DESCRIPTION',
220
221
  description: 'Your app description',
222
+ optional: true),
223
+ FastlaneCore::ConfigItem.new(key: :changelog,
224
+ env_name: 'FL_APPALOOSA_CHANGELOG',
225
+ description: 'Your app changelog',
221
226
  optional: true)
222
227
  ]
223
228
  end
@@ -3,7 +3,7 @@ module Fastlane
3
3
  class BackupFileAction < Action
4
4
  def self.run(params)
5
5
  path = params[:path]
6
- FileUtils.cp(path, "#{path}.back", { preserve: true })
6
+ FileUtils.cp(path, "#{path}.back", preserve: true)
7
7
  UI.message("Successfully created a backup 💾")
8
8
  end
9
9
 
@@ -120,6 +120,10 @@ module Fastlane
120
120
  "The absolute path to the generated ipa file"
121
121
  end
122
122
 
123
+ def self.return_type
124
+ :string
125
+ end
126
+
123
127
  def self.author
124
128
  "KrauseFx"
125
129
  end
@@ -28,6 +28,10 @@ module Fastlane
28
28
  return "true if precheck passes, else, false"
29
29
  end
30
30
 
31
+ def self.return_type
32
+ :bool
33
+ end
34
+
31
35
  def self.authors
32
36
  ["taquitos"]
33
37
  end
@@ -33,6 +33,7 @@ module Fastlane
33
33
  GithubApiAction.run({
34
34
  server_url: params[:server_url],
35
35
  api_token: params[:api_token],
36
+ api_bearer: params[:api_bearer],
36
37
  secure: params[:secure],
37
38
  http_method: "PUT",
38
39
  path: File.join("repos", params[:repository_name], "contents", api_file_path),
@@ -104,12 +105,21 @@ module Fastlane
104
105
  FastlaneCore::ConfigItem.new(key: :api_token,
105
106
  env_name: "FL_COMMIT_GITHUB_FILE_API_TOKEN",
106
107
  description: "Personal API Token for GitHub - generate one at https://github.com/settings/tokens",
108
+ conflicting_options: [:api_bearer],
107
109
  sensitive: true,
108
110
  is_string: true,
109
111
  code_gen_sensitive: true,
110
112
  default_value: ENV["GITHUB_API_TOKEN"],
111
113
  default_value_dynamic: true,
112
- optional: false),
114
+ optional: true),
115
+ FastlaneCore::ConfigItem.new(key: :api_bearer,
116
+ env_name: "FL_COMMIT_GITHUB_FILE_API_BEARER",
117
+ sensitive: true,
118
+ code_gen_sensitive: true,
119
+ description: "Use a Bearer authorization token. Usually generated by Github Apps, e.g. GitHub Actions GITHUB_TOKEN environment variable",
120
+ conflicting_options: [:api_token],
121
+ optional: true,
122
+ default_value: nil),
113
123
  FastlaneCore::ConfigItem.new(key: :branch,
114
124
  env_name: "FL_COMMIT_GITHUB_FILE_BRANCH",
115
125
  description: "The branch that the file should be committed on (default: master)",
@@ -14,6 +14,11 @@ module Fastlane
14
14
  create_command << ['-output', "\"#{params[:output]}\""]
15
15
  create_command << ['-allow-internal-distribution'] if params[:allow_internal_distribution]
16
16
 
17
+ if File.directory?(params[:output])
18
+ UI.message("Deleting existing: #{params[:output]}")
19
+ FileUtils.remove_dir(params[:output])
20
+ end
21
+
17
22
  Actions.lane_context[SharedValues::XCFRAMEWORK_PATH] = params[:output]
18
23
 
19
24
  sh(create_command)
@@ -138,7 +138,7 @@ Inside of a given locale directory is a folder called `images`. Here you can sup
138
138
  - `promoGraphic`
139
139
  - `tvBanner`
140
140
 
141
- You can also supply screenshots by creating directories within the `images` directory with the following names, containing PNGs or JPEGs (image names are irrelevant):
141
+ You can also supply screenshots by creating directories within the `images` directory with the following names, containing PNGs or JPEGs:
142
142
 
143
143
  - `phoneScreenshots/`
144
144
  - `sevenInchScreenshots/` (7-inch tablets)
@@ -146,6 +146,7 @@ You can also supply screenshots by creating directories within the `images` dire
146
146
  - `tvScreenshots/`
147
147
  - `wearScreenshots/`
148
148
 
149
+ You may name images anything you like, but screenshots will appear in the Play Store in alphanumerical filename order.
149
150
  Note that these will replace the current images and screenshots on the play store listing, not add to them.
150
151
 
151
152
  ## Changelogs (What's new)
@@ -11,6 +11,7 @@ module Fastlane
11
11
  GithubApiAction.run(
12
12
  server_url: params[:server_url],
13
13
  api_token: params[:api_token],
14
+ api_bearer: params[:api_bearer],
14
15
  http_method: 'GET',
15
16
  path: "repos/#{params[:url]}/releases",
16
17
  error_handlers: {
@@ -133,7 +134,16 @@ module Fastlane
133
134
  default_value: ENV["GITHUB_API_TOKEN"],
134
135
  default_value_dynamic: true,
135
136
  description: "GitHub Personal Token (required for private repositories)",
136
- optional: true)
137
+ conflicting_options: [:api_bearer],
138
+ optional: true),
139
+ FastlaneCore::ConfigItem.new(key: :api_bearer,
140
+ env_name: "FL_GITHUB_RELEASE_API_BEARER",
141
+ sensitive: true,
142
+ code_gen_sensitive: true,
143
+ description: "Use a Bearer authorization token. Usually generated by Github Apps, e.g. GitHub Actions GITHUB_TOKEN environment variable",
144
+ conflicting_options: [:api_token],
145
+ optional: true,
146
+ default_value: nil)
137
147
  ]
138
148
  end
139
149
 
@@ -68,6 +68,10 @@ module Fastlane
68
68
  "The UUID of the profile sigh just fetched/generated"
69
69
  end
70
70
 
71
+ def self.return_type
72
+ :string
73
+ end
74
+
71
75
  def self.details
72
76
  "**Note**: It is recommended to use [match](https://docs.fastlane.tools/actions/match/) according to the [codesigning.guide](https://codesigning.guide) for generating and maintaining your provisioning profiles. Use _sigh_ directly only if you want full control over what's going on and know more about codesigning."
73
77
  end
@@ -8,14 +8,15 @@ module Fastlane
8
8
  require 'shellwords'
9
9
 
10
10
  def self.run(params)
11
- folder = params[:xcodeproj] ? File.join(params[:xcodeproj], '..') : '.'
11
+ xcodeproj_path_or_dir = params[:xcodeproj] || '.'
12
+ xcodeproj_dir = File.extname(xcodeproj_path_or_dir) == ".xcodeproj" ? File.dirname(xcodeproj_path_or_dir) : xcodeproj_path_or_dir
12
13
  target_name = params[:target]
13
14
  configuration = params[:configuration]
14
15
 
15
16
  # Get version_number
16
- project = get_project!(folder)
17
+ project = get_project!(xcodeproj_path_or_dir)
17
18
  target = get_target!(project, target_name)
18
- plist_file = get_plist!(folder, target, configuration)
19
+ plist_file = get_plist!(xcodeproj_dir, target, configuration)
19
20
  version_number = get_version_number_from_plist!(plist_file)
20
21
 
21
22
  # Get from build settings (or project settings) if needed (ex: $(MARKETING_VERSION) is default in Xcode 11)
@@ -39,13 +40,18 @@ module Fastlane
39
40
  return version_number
40
41
  end
41
42
 
42
- def self.get_project!(folder)
43
+ def self.get_project!(xcodeproj_path_or_dir)
43
44
  require 'xcodeproj'
44
- project_path = Dir.glob("#{folder}/*.xcodeproj").first
45
- if project_path
45
+ if File.extname(xcodeproj_path_or_dir) == ".xcodeproj"
46
+ project_path = xcodeproj_path_or_dir
47
+ else
48
+ project_path = Dir.glob("#{xcodeproj_path_or_dir}/*.xcodeproj").first
49
+ end
50
+
51
+ if project_path && File.exist?(project_path)
46
52
  return Xcodeproj::Project.open(project_path)
47
53
  else
48
- UI.user_error!("Unable to find Xcode project in folder: #{folder}")
54
+ UI.user_error!("Unable to find Xcode project at #{project_path || xcodeproj_path_or_dir}")
49
55
  end
50
56
  end
51
57
 
@@ -147,11 +153,12 @@ module Fastlane
147
153
  [
148
154
  FastlaneCore::ConfigItem.new(key: :xcodeproj,
149
155
  env_name: "FL_VERSION_NUMBER_PROJECT",
150
- description: "Path to the main Xcode project to read version number from, optional. By default will use the first Xcode project found within the project root directory",
156
+ description: "Path to the Xcode project to read version number from, or its containing directory, optional. If ommitted, or if a directory is passed instead, it will use the first Xcode project found within the given directory, or the project root directory if none is passed",
151
157
  optional: true,
152
158
  verify_block: proc do |value|
153
- UI.user_error!("Please pass the path to the project, not the workspace") if value.end_with?(".xcworkspace")
154
- UI.user_error!("Could not find Xcode project at path '#{File.expand_path(value)}'") if !File.exist?(value) && !Helper.test?
159
+ UI.user_error!("Please pass the path to the project or its containing directory, not the workspace path") if value.end_with?(".xcworkspace")
160
+ UI.user_error!("Could not find file or directory at path '#{File.expand_path(value)}'") unless File.exist?(value)
161
+ UI.user_error!("Could not find Xcode project in directory at path '#{File.expand_path(value)}'") if File.extname(value) != ".xcodeproj" && Dir.glob("#{value}/*.xcodeproj").empty?
155
162
  end),
156
163
  FastlaneCore::ConfigItem.new(key: :target,
157
164
  env_name: "FL_VERSION_NUMBER_TARGET",
@@ -1,16 +1,10 @@
1
1
  module Fastlane
2
2
  module Actions
3
- module SharedValues
4
- GIT_BRANCH_ENV_VARS = %w(GIT_BRANCH BRANCH_NAME TRAVIS_BRANCH BITRISE_GIT_BRANCH CI_BUILD_REF_NAME CI_COMMIT_REF_NAME WERCKER_GIT_BRANCH BUILDKITE_BRANCH APPCENTER_BRANCH CIRCLE_BRANCH).reject do |branch|
5
- # Removing because tests break on CircleCI
6
- Helper.test? && branch == "CIRCLE_BRANCH"
7
- end.freeze
8
- end
9
-
10
3
  class GitBranchAction < Action
11
4
  def self.run(params)
12
- env_name = SharedValues::GIT_BRANCH_ENV_VARS.find { |env_var| FastlaneCore::Env.truthy?(env_var) }
13
- ENV.fetch(env_name.to_s) { `git symbolic-ref HEAD --short 2>/dev/null`.strip }
5
+ branch = Actions.git_branch
6
+ return "" if branch == "HEAD" # Backwards compatibility with the original (and documented) implementation
7
+ branch
14
8
  end
15
9
 
16
10
  #####################################################
@@ -22,7 +16,7 @@ module Fastlane
22
16
  end
23
17
 
24
18
  def self.details
25
- "If no branch could be found, this action will return an empty string"
19
+ "If no branch could be found, this action will return an empty string. This is a wrapper for the internal action Actions.git_branch"
26
20
  end
27
21
 
28
22
  def self.available_options
@@ -45,6 +45,10 @@ module Fastlane
45
45
  "Boolean value whether the tag exists or not"
46
46
  end
47
47
 
48
+ def self.return_type
49
+ :bool
50
+ end
51
+
48
52
  def self.output
49
53
  [
50
54
  ]
@@ -143,8 +143,9 @@ module Fastlane
143
143
  default_value: {},
144
144
  optional: true),
145
145
  FastlaneCore::ConfigItem.new(key: :headers,
146
+ env_name: "FL_GITHUB_API_HEADERS",
146
147
  description: "Optional headers to apply",
147
- is_string: false,
148
+ type: Hash,
148
149
  default_value: {},
149
150
  optional: true),
150
151
  FastlaneCore::ConfigItem.new(key: :secure,
@@ -33,10 +33,11 @@ module Fastlane
33
33
  agv_disabled = !system([command_prefix, 'agvtool what-version', command_suffix].join(' '))
34
34
  raise "Apple Generic Versioning is not enabled." if agv_disabled && params[:build_number].nil?
35
35
 
36
+ mode = params[:skip_info_plist] ? '' : ' -all'
36
37
  command = [
37
38
  command_prefix,
38
39
  'agvtool',
39
- params[:build_number] ? "new-version -all #{params[:build_number].to_s.strip}" : 'next-version -all',
40
+ params[:build_number] ? "new-version#{mode} #{params[:build_number].to_s.strip}" : "next-version#{mode}",
40
41
  command_suffix
41
42
  ].join(' ')
42
43
 
@@ -66,6 +67,12 @@ module Fastlane
66
67
  description: "Change to a specific version. When you provide this parameter, Apple Generic Versioning does not have to be enabled",
67
68
  optional: true,
68
69
  is_string: false),
70
+ FastlaneCore::ConfigItem.new(key: :skip_info_plist,
71
+ env_name: "FL_BUILD_NUMBER_SKIP_INFO_PLIST",
72
+ description: "Don't update Info.plist files when updating the build version",
73
+ is_string: false,
74
+ type: Boolean,
75
+ default_value: false),
69
76
  FastlaneCore::ConfigItem.new(key: :xcodeproj,
70
77
  env_name: "FL_BUILD_NUMBER_PROJECT",
71
78
  description: "optional, you must specify the path to your main Xcode project if it is not in the project root directory",
@@ -48,6 +48,10 @@ module Fastlane
48
48
  "The absolute path to the installed provisioning profile"
49
49
  end
50
50
 
51
+ def self.return_type
52
+ :string
53
+ end
54
+
51
55
  def self.example_code
52
56
  [
53
57
  'install_provisioning_profile(path: "profiles/profile.mobileprovision")'
@@ -5,6 +5,7 @@ module Fastlane
5
5
  Actions.verify_gem!('jazzy')
6
6
  command = "jazzy"
7
7
  command << " --config #{params[:config]}" if params[:config]
8
+ command << " --module-version #{params[:module_version]}" if params[:module_version]
8
9
  Actions.sh(command)
9
10
  end
10
11
 
@@ -24,6 +25,13 @@ module Fastlane
24
25
  description: 'Path to jazzy config file',
25
26
  is_string: true,
26
27
  optional: true
28
+ ),
29
+ FastlaneCore::ConfigItem.new(
30
+ key: :module_version,
31
+ env_name: 'FL_JAZZY_MODULE_VERSION',
32
+ description: 'Version string to use as part of the the default docs title and inside the docset',
33
+ is_string: true,
34
+ optional: true
27
35
  )
28
36
  ]
29
37
  end
@@ -44,7 +52,8 @@ module Fastlane
44
52
 
45
53
  def self.example_code
46
54
  [
47
- 'jazzy'
55
+ 'jazzy',
56
+ 'jazzy(config: ".jazzy.yaml", module_version: "2.1.37")'
48
57
  ]
49
58
  end
50
59
 
@@ -1,5 +1,9 @@
1
1
  module Fastlane
2
2
  module Actions
3
+ module SharedValues
4
+ JIRA_JSON = :JIRA_JSON
5
+ end
6
+
3
7
  class JiraAction < Action
4
8
  def self.run(params)
5
9
  Actions.verify_gem!('jira-ruby')
@@ -21,10 +25,28 @@ module Fastlane
21
25
  password: password
22
26
  }
23
27
 
24
- client = JIRA::Client.new(options)
25
- issue = client.Issue.find(ticket_id)
26
- comment = issue.comments.build
27
- comment.save({ 'body' => comment_text })
28
+ begin
29
+ client = JIRA::Client.new(options)
30
+ issue = client.Issue.find(ticket_id)
31
+ comment = issue.comments.build
32
+ comment.save({ 'body' => comment_text })
33
+
34
+ # An exact representation of the JSON returned from the JIRA API
35
+ # https://github.com/sumoheavy/jira-ruby/blob/master/lib/jira/base.rb#L67
36
+ json_response = comment.attrs
37
+ raise 'Failed to add a comment on Jira ticket' if json_response.nil?
38
+
39
+ Actions.lane_context[SharedValues::JIRA_JSON] = json_response
40
+ UI.success('Successfully added a comment on Jira ticket')
41
+ return json_response
42
+ rescue => exception
43
+ message = "Received exception when adding a Jira comment: #{exception}"
44
+ if params[:fail_on_error]
45
+ UI.user_error!(message)
46
+ else
47
+ UI.error(message)
48
+ end
49
+ end
28
50
  end
29
51
 
30
52
  #####################################################
@@ -32,7 +54,7 @@ module Fastlane
32
54
  #####################################################
33
55
 
34
56
  def self.description
35
- "Leave a comment on JIRA tickets"
57
+ "Leave a comment on a Jira ticket"
36
58
  end
37
59
 
38
60
  def self.available_options
@@ -50,13 +72,13 @@ module Fastlane
50
72
  default_value: ""),
51
73
  FastlaneCore::ConfigItem.new(key: :username,
52
74
  env_name: "FL_JIRA_USERNAME",
53
- description: "Username for JIRA instance",
75
+ description: "Username for Jira instance",
54
76
  verify_block: proc do |value|
55
77
  UI.user_error!("No username") if value.to_s.length == 0
56
78
  end),
57
79
  FastlaneCore::ConfigItem.new(key: :password,
58
80
  env_name: "FL_JIRA_PASSWORD",
59
- description: "Password for Jira",
81
+ description: "Password or API token for Jira",
60
82
  sensitive: true,
61
83
  verify_block: proc do |value|
62
84
  UI.user_error!("No password") if value.to_s.length == 0
@@ -72,15 +94,35 @@ module Fastlane
72
94
  description: "Text to add to the ticket as a comment",
73
95
  verify_block: proc do |value|
74
96
  UI.user_error!("No comment specified") if value.to_s.length == 0
75
- end)
97
+ end),
98
+ FastlaneCore::ConfigItem.new(key: :fail_on_error,
99
+ env_name: "FL_JIRA_FAIL_ON_ERROR",
100
+ description: "Should an error adding the Jira comment cause a failure?",
101
+ type: Boolean,
102
+ optional: true,
103
+ default_value: true) # Default value is true for 'Backward compatibility'
104
+ ]
105
+ end
106
+
107
+ def self.output
108
+ [
109
+ ['JIRA_JSON', 'The whole Jira API JSON object']
76
110
  ]
77
111
  end
78
112
 
79
113
  def self.return_value
114
+ [
115
+ "A hash containing all relevant information of the Jira comment",
116
+ "Access Jira comment 'id', 'author', 'body', and more"
117
+ ].join("\n")
118
+ end
119
+
120
+ def self.return_type
121
+ :hash
80
122
  end
81
123
 
82
124
  def self.authors
83
- ["iAmChrisTruman"]
125
+ ["iAmChrisTruman", "crazymanish"]
84
126
  end
85
127
 
86
128
  def self.is_supported?(platform)
@@ -92,17 +134,22 @@ module Fastlane
92
134
  'jira(
93
135
  url: "https://bugs.yourdomain.com",
94
136
  username: "Your username",
95
- password: "Your password",
96
- ticket_id: "Ticket ID, i.e. IOS-123",
137
+ password: "Your password or API token",
138
+ ticket_id: "IOS-123",
97
139
  comment_text: "Text to post as a comment"
98
- )',
140
+ )', # How to get API token: https://developer.atlassian.com/cloud/jira/platform/basic-auth-for-rest-apis/#get-an-api-token
99
141
  'jira(
100
142
  url: "https://yourserverdomain.com",
101
143
  context_path: "/jira",
102
144
  username: "Your username",
103
- password: "Your password",
104
- ticket_id: "Ticket ID, i.e. IOS-123",
145
+ password: "Your password or API token",
146
+ ticket_id: "IOS-123",
105
147
  comment_text: "Text to post as a comment"
148
+ )',
149
+ 'jira(
150
+ ticket_id: "IOS-123",
151
+ comment_text: "Text to post as a comment",
152
+ fail_on_error: false
106
153
  )'
107
154
  ]
108
155
  end