fastlane 2.241.2 → 2.242.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +38 -38
  3. data/cert/lib/cert/runner.rb +1 -1
  4. data/credentials_manager/README.md +3 -3
  5. data/credentials_manager/lib/credentials_manager/account_manager.rb +13 -3
  6. data/deliver/lib/deliver/runner.rb +5 -0
  7. data/fastlane/lib/assets/certificates/AppleIncRootCertificate.cer +0 -0
  8. data/fastlane/lib/assets/certificates/AppleRootCA-G3.cer +0 -0
  9. data/fastlane/lib/fastlane/action.rb +8 -6
  10. data/fastlane/lib/fastlane/actions/app_store_connect_api_key.rb +1 -1
  11. data/fastlane/lib/fastlane/actions/changelog_from_git_commits.rb +0 -3
  12. data/fastlane/lib/fastlane/actions/clipboard.rb +1 -1
  13. data/fastlane/lib/fastlane/actions/commit_version_bump.rb +0 -1
  14. data/fastlane/lib/fastlane/actions/create_keychain.rb +20 -29
  15. data/fastlane/lib/fastlane/actions/delete_keychain.rb +5 -3
  16. data/fastlane/lib/fastlane/actions/docs/build_app.md +1 -1
  17. data/fastlane/lib/fastlane/actions/docs/create_app_online.md +1 -1
  18. data/fastlane/lib/fastlane/actions/docs/frame_screenshots.md +4 -4
  19. data/fastlane/lib/fastlane/actions/docs/get_provisioning_profile.md +1 -1
  20. data/fastlane/lib/fastlane/actions/docs/upload_to_app_store.md.erb +1 -1
  21. data/fastlane/lib/fastlane/actions/docs/upload_to_play_store.md +12 -0
  22. data/fastlane/lib/fastlane/actions/download_app_privacy_details_from_app_store.rb +5 -4
  23. data/fastlane/lib/fastlane/actions/download_dsyms.rb +3 -1
  24. data/fastlane/lib/fastlane/actions/get_managed_play_store_publishing_rights.rb +1 -0
  25. data/fastlane/lib/fastlane/actions/git_pull.rb +1 -1
  26. data/fastlane/lib/fastlane/actions/hg_commit_version_bump.rb +0 -1
  27. data/fastlane/lib/fastlane/actions/import_certificate.rb +18 -6
  28. data/fastlane/lib/fastlane/actions/import_from_gem.rb +70 -0
  29. data/fastlane/lib/fastlane/actions/jazzy.rb +1 -1
  30. data/fastlane/lib/fastlane/actions/lcov.rb +1 -1
  31. data/fastlane/lib/fastlane/actions/mailgun.rb +2 -2
  32. data/fastlane/lib/fastlane/actions/make_changelog_from_jenkins.rb +1 -1
  33. data/fastlane/lib/fastlane/actions/notarize.rb +55 -7
  34. data/fastlane/lib/fastlane/actions/prompt.rb +1 -1
  35. data/fastlane/lib/fastlane/actions/push_to_git_remote.rb +2 -2
  36. data/fastlane/lib/fastlane/actions/sh.rb +20 -2
  37. data/fastlane/lib/fastlane/actions/sourcedocs.rb +2 -2
  38. data/fastlane/lib/fastlane/actions/swiftlint.rb +5 -2
  39. data/fastlane/lib/fastlane/actions/unlock_keychain.rb +17 -29
  40. data/fastlane/lib/fastlane/actions/update_fastlane.rb +10 -3
  41. data/fastlane/lib/fastlane/actions/update_project_code_signing.rb +2 -1
  42. data/fastlane/lib/fastlane/actions/update_project_provisioning.rb +21 -18
  43. data/fastlane/lib/fastlane/actions/upload_app_privacy_details_to_app_store.rb +1 -1
  44. data/fastlane/lib/fastlane/actions/upload_symbols_to_crashlytics.rb +8 -2
  45. data/fastlane/lib/fastlane/actions/verify_build.rb +2 -1
  46. data/fastlane/lib/fastlane/actions/verify_pod_keys.rb +2 -1
  47. data/fastlane/lib/fastlane/actions/xcodebuild.rb +1 -1
  48. data/fastlane/lib/fastlane/cli_tools_distributor.rb +7 -0
  49. data/fastlane/lib/fastlane/environment_printer.rb +14 -14
  50. data/fastlane/lib/fastlane/fast_file.rb +35 -4
  51. data/fastlane/lib/fastlane/helper/sh_helper.rb +27 -45
  52. data/fastlane/lib/fastlane/lane_list.rb +1 -1
  53. data/fastlane/lib/fastlane/plugins/plugin_manager.rb +2 -2
  54. data/fastlane/lib/fastlane/plugins/template/.rubocop.yml +0 -2
  55. data/fastlane/lib/fastlane/runner.rb +4 -6
  56. data/fastlane/lib/fastlane/server/socket_server_action_command_executor.rb +4 -4
  57. data/fastlane/lib/fastlane/swift_fastlane_api_generator.rb +3 -3
  58. data/fastlane/lib/fastlane/version.rb +2 -1
  59. data/fastlane/swift/Deliverfile.swift +1 -1
  60. data/fastlane/swift/DeliverfileProtocol.swift +1 -1
  61. data/fastlane/swift/Fastlane.swift +46 -152
  62. data/fastlane/swift/Gymfile.swift +1 -1
  63. data/fastlane/swift/GymfileProtocol.swift +1 -1
  64. data/fastlane/swift/Matchfile.swift +1 -1
  65. data/fastlane/swift/MatchfileProtocol.swift +1 -1
  66. data/fastlane/swift/Precheckfile.swift +1 -1
  67. data/fastlane/swift/PrecheckfileProtocol.swift +1 -1
  68. data/fastlane/swift/Runner.swift +1 -1
  69. data/fastlane/swift/Scanfile.swift +1 -1
  70. data/fastlane/swift/ScanfileProtocol.swift +1 -1
  71. data/fastlane/swift/Screengrabfile.swift +1 -1
  72. data/fastlane/swift/ScreengrabfileProtocol.swift +1 -1
  73. data/fastlane/swift/Snapshotfile.swift +1 -1
  74. data/fastlane/swift/SnapshotfileProtocol.swift +1 -1
  75. data/fastlane_core/lib/fastlane_core/cert_checker.rb +40 -76
  76. data/fastlane_core/lib/fastlane_core/command_executor.rb +128 -7
  77. data/fastlane_core/lib/fastlane_core/configuration/config_item.rb +1 -1
  78. data/fastlane_core/lib/fastlane_core/configuration/configuration_file.rb +1 -1
  79. data/fastlane_core/lib/fastlane_core/device_manager.rb +14 -5
  80. data/fastlane_core/lib/fastlane_core/fastlane_pty.rb +25 -10
  81. data/fastlane_core/lib/fastlane_core/helper.rb +26 -2
  82. data/fastlane_core/lib/fastlane_core/ios_app_identifier_guesser.rb +1 -1
  83. data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +24 -19
  84. data/fastlane_core/lib/fastlane_core/keychain_importer.rb +48 -71
  85. data/fastlane_core/lib/fastlane_core/pkg_file_analyser.rb +5 -1
  86. data/fastlane_core/lib/fastlane_core/print_table.rb +1 -1
  87. data/fastlane_core/lib/fastlane_core/queue_worker.rb +0 -2
  88. data/fastlane_core/lib/fastlane_core/stored_passwords.rb +29 -0
  89. data/fastlane_core/lib/fastlane_core/string_filters.rb +1 -2
  90. data/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb +8 -4
  91. data/fastlane_core/lib/fastlane_core/ui/github_issue_inspector_reporter.rb +2 -2
  92. data/fastlane_core/lib/fastlane_core/ui/implementations/shell.rb +1 -1
  93. data/frameit/lib/frameit/device_types.rb +11 -4
  94. data/frameit/lib/frameit/editor.rb +31 -12
  95. data/frameit/lib/frameit/frame_downloader.rb +4 -1
  96. data/gym/lib/gym/detect_values.rb +10 -10
  97. data/gym/lib/gym/options.rb +1 -7
  98. data/gym/lib/gym/runner.rb +6 -1
  99. data/match/lib/match/encryption/encryption.rb +6 -1
  100. data/match/lib/match/encryption/openssl.rb +8 -3
  101. data/match/lib/match/portal_fetcher.rb +12 -6
  102. data/match/lib/match/runner.rb +2 -1
  103. data/pem/lib/pem/manager.rb +3 -3
  104. data/precheck/lib/precheck/runner.rb +4 -2
  105. data/scan/lib/scan/detect_values.rb +0 -1
  106. data/scan/lib/scan/runner.rb +1 -0
  107. data/sigh/lib/assets/resign.sh +10 -3
  108. data/sigh/lib/sigh/resign.rb +5 -21
  109. data/snapshot/lib/snapshot/reset_simulators.rb +5 -2
  110. data/snapshot/lib/snapshot/runner.rb +0 -1
  111. data/spaceship/lib/spaceship/base.rb +1 -1
  112. data/spaceship/lib/spaceship/client.rb +6 -3
  113. data/spaceship/lib/spaceship/connect_api/api_client.rb +12 -14
  114. data/spaceship/lib/spaceship/connect_api/models/bundle_id.rb +1 -1
  115. data/spaceship/lib/spaceship/connect_api/models/user.rb +7 -3
  116. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +9 -11
  117. data/spaceship/lib/spaceship/connect_api/token.rb +21 -1
  118. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +3 -1
  119. data/spaceship/lib/spaceship/helper/plist_middleware.rb +2 -2
  120. data/spaceship/lib/spaceship/portal/portal_client.rb +8 -8
  121. data/spaceship/lib/spaceship/test_flight/client.rb +1 -5
  122. data/supply/lib/supply/client.rb +1 -1
  123. data/supply/lib/supply/options.rb +6 -0
  124. data/supply/lib/supply/uploader.rb +28 -2
  125. metadata +29 -26
  126. data/fastlane/lib/fastlane/actions/hockey.rb +0 -400
  127. data/fastlane/lib/fastlane/actions/typetalk.rb +0 -93
@@ -336,7 +336,7 @@ module Spaceship
336
336
 
337
337
  def merchants(mac: false)
338
338
  paging do |page_number|
339
- r = request(:post, "account/#{platform_slug(mac)}/identifiers/listOMCs.action", {
339
+ r = request(:post, "account/ios/identifiers/listOMCs.action", {
340
340
  teamId: team_id,
341
341
  pageNumber: page_number,
342
342
  pageSize: page_size,
@@ -347,7 +347,7 @@ module Spaceship
347
347
  end
348
348
 
349
349
  def merchant_domains(merchant_id, mac: false)
350
- r = request(:post, "account/#{platform_slug(mac)}/identifiers/listDomainsForMerchant", {
350
+ r = request(:post, "account/ios/identifiers/listDomainsForMerchant", {
351
351
  merchantId: merchant_id,
352
352
  teamId: team_id
353
353
  })
@@ -355,7 +355,7 @@ module Spaceship
355
355
  end
356
356
 
357
357
  def merchant_domain_get_verification_file(domain_id, mac: false)
358
- r = request(:get, "account/#{platform_slug(mac)}/identifiers/downloadDomainVerificationFile", {
358
+ r = request(:get, "account/ios/identifiers/downloadDomainVerificationFile", {
359
359
  teamId: team_id,
360
360
  domainId: domain_id
361
361
  })
@@ -373,7 +373,7 @@ module Spaceship
373
373
  def merchant_domain_verify(domain_id, mac: false)
374
374
  ensure_csrf(Spaceship::Portal::Merchant)
375
375
 
376
- r = request(:post, "account/#{platform_slug(mac)}/identifiers/verifyDomain", {
376
+ r = request(:post, "account/ios/identifiers/verifyDomain", {
377
377
  domainId: domain_id,
378
378
  teamId: team_id
379
379
  })
@@ -383,7 +383,7 @@ module Spaceship
383
383
  def create_merchant_domain!(merchant_id, domain_name, mac: false)
384
384
  ensure_csrf(Spaceship::Portal::Merchant)
385
385
 
386
- r = request(:post, "account/#{platform_slug(mac)}/identifiers/registerDomain", {
386
+ r = request(:post, "account/ios/identifiers/registerDomain", {
387
387
  domainName: domain_name,
388
388
  merchantId: merchant_id,
389
389
  teamId: team_id
@@ -394,7 +394,7 @@ module Spaceship
394
394
  def delete_merchant_domain!(domain_id, merchant_id, mac: false)
395
395
  ensure_csrf(Spaceship::Portal::Merchant)
396
396
 
397
- r = request(:post, "account/#{platform_slug(mac)}/identifiers/removeDomain", {
397
+ r = request(:post, "account/ios/identifiers/removeDomain", {
398
398
  merchantId: merchant_id,
399
399
  domainId: domain_id,
400
400
  teamId: team_id
@@ -405,7 +405,7 @@ module Spaceship
405
405
  def create_merchant!(name, bundle_id, mac: false)
406
406
  ensure_csrf(Spaceship::Portal::Merchant)
407
407
 
408
- r = request(:post, "account/#{platform_slug(mac)}/identifiers/addOMC.action", {
408
+ r = request(:post, "account/ios/identifiers/addOMC.action", {
409
409
  name: name,
410
410
  identifier: bundle_id,
411
411
  teamId: team_id
@@ -416,7 +416,7 @@ module Spaceship
416
416
  def delete_merchant!(merchant_id, mac: false)
417
417
  ensure_csrf(Spaceship::Portal::Merchant)
418
418
 
419
- r = request(:post, "account/#{platform_slug(mac)}/identifiers/deleteOMC.action", {
419
+ r = request(:post, "account/ios/identifiers/deleteOMC.action", {
420
420
  teamId: team_id,
421
421
  omcId: merchant_id
422
422
  })
@@ -323,11 +323,7 @@ module Spaceship
323
323
  end
324
324
 
325
325
  def local_variable_get(binding, name)
326
- if binding.respond_to?(:local_variable_get)
327
- binding.local_variable_get(name)
328
- else
329
- binding.eval(name.to_s)
330
- end
326
+ binding.local_variable_get(name)
331
327
  end
332
328
 
333
329
  def provider_id
@@ -82,7 +82,7 @@ module Supply
82
82
 
83
83
  UI.verbose("Fetching a new access token from Google...")
84
84
 
85
- auth_client.fetch_access_token!
85
+ auth_client.apply!({}) # fetches the first token; fetch_access_token! is private on impersonated credentials
86
86
 
87
87
  if FastlaneCore::Env.truthy?("DEBUG")
88
88
  Google::Apis.logger.level = Logger::DEBUG
@@ -231,6 +231,12 @@ module Supply
231
231
  verify_block: proc do |value|
232
232
  UI.user_error!("Value must be one of '#{Supply::RELEASE_STATUS}'") unless Supply::ReleaseStatus::ALL.include?(value)
233
233
  end),
234
+ FastlaneCore::ConfigItem.new(key: :track_promote_force,
235
+ env_name: "SUPPLY_TRACK_PROMOTE_FORCE",
236
+ optional: true,
237
+ description: "Force the promotion of a version code that is no longer returned for the source track (:version_code and :version_name are required)",
238
+ type: Boolean,
239
+ default_value: false),
234
240
  FastlaneCore::ConfigItem.new(key: :validate_only,
235
241
  env_name: "SUPPLY_VALIDATE_ONLY",
236
242
  optional: true,
@@ -196,8 +196,11 @@ module Supply
196
196
  UI.user_error!("Cannot promote from track '#{Supply.config[:track]}' - track doesn't exist")
197
197
  end
198
198
 
199
- releases = track_from.releases
200
- if Supply.config[:version_code].to_s != ""
199
+ releases = track_from.releases || []
200
+
201
+ if Supply.config[:track_promote_force]
202
+ releases = [forced_track_release]
203
+ elsif Supply.config[:version_code].to_s != ""
201
204
  releases = releases.select do |release|
202
205
  release.version_codes.include?(Supply.config[:version_code].to_s)
203
206
  end
@@ -239,6 +242,29 @@ module Supply
239
242
  client.update_track(Supply.config[:track_promote_to], track_to)
240
243
  end
241
244
 
245
+ # Builds the release to promote instead of looking it up in the source track.
246
+ #
247
+ # The Play Developer API only returns the release currently serving each
248
+ # track, so a version that has already been superseded is absent from the
249
+ # payload and cannot be found by `promote_track`, even though the Play
250
+ # Console still allows promoting it. Building the release out of the
251
+ # configured values is the only way to promote such a version.
252
+ # See https://github.com/fastlane/fastlane/issues/18497
253
+ def forced_track_release
254
+ version_code = Supply.config[:version_code].to_s
255
+ version_name = Supply.config[:version_name].to_s
256
+
257
+ UI.user_error!("To force a track promotion, it is mandatory to enter the :version_code") if version_code.empty?
258
+ UI.user_error!("To force a track promotion, it is mandatory to enter the :version_name") if version_name.empty?
259
+
260
+ UI.important("Forcing the promotion of version code '#{version_code}' - it is not checked against track '#{Supply.config[:track]}'")
261
+
262
+ AndroidPublisher::TrackRelease.new(
263
+ name: version_name,
264
+ version_codes: [version_code]
265
+ )
266
+ end
267
+
242
268
  def upload_changelog(language, version_code)
243
269
  UI.user_error!("Cannot find changelog because no version code given - please specify :version_code") unless version_code
244
270
 
metadata CHANGED
@@ -1,36 +1,36 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.241.2
4
+ version: 2.242.0
5
5
  platform: ruby
6
6
  authors:
7
- - Josh Holtz
8
- - Jimmy Dee
9
- - Joshua Liebowitz
10
- - Max Ott
11
- - Olivier Halligon
7
+ - Connor Tumbleson
8
+ - Felix Krause
9
+ - Matthew Ellis
10
+ - Danielle Tomlinson
11
+ - Roger Oba
12
12
  - Helmut Januschka
13
+ - Stefan Natchev
13
14
  - Satoshi Namai
14
- - Danielle Tomlinson
15
+ - Jérôme Lacoste
15
16
  - Manish Rathi
16
- - Iulian Onofrei
17
- - Kohki Miki
18
- - Jorge Revuelta H
17
+ - Aaron Brager
19
18
  - Andrew McBurney
20
- - Connor Tumbleson
21
- - Jan Piotrowski
22
- - Maksym Grebenets
23
- - Manu Wallner
24
- - Stefan Natchev
19
+ - Olivier Halligon
20
+ - Kohki Miki
21
+ - Iulian Onofrei
22
+ - Max Ott
23
+ - Daniel Jankowski
25
24
  - Łukasz Grabowski
26
- - Matthew Ellis
27
- - Roger Oba
28
- - Luka Mirosevic
29
- - Aaron Brager
25
+ - Josh Holtz
30
26
  - Fumiya Nakamura
31
- - Jérôme Lacoste
32
- - Daniel Jankowski
33
- - Felix Krause
27
+ - Luka Mirosevic
28
+ - Jan Piotrowski
29
+ - Jimmy Dee
30
+ - Joshua Liebowitz
31
+ - Manu Wallner
32
+ - Maksym Grebenets
33
+ - Jorge Revuelta H
34
34
  bindir: bin
35
35
  cert_chain: []
36
36
  date: 1980-01-02 00:00:00.000000000 Z
@@ -619,14 +619,14 @@ dependencies:
619
619
  requirements:
620
620
  - - "~>"
621
621
  - !ruby/object:Gem::Version
622
- version: '0.3'
622
+ version: '0.4'
623
623
  type: :runtime
624
624
  prerelease: false
625
625
  version_requirements: !ruby/object:Gem::Requirement
626
626
  requirements:
627
627
  - - "~>"
628
628
  - !ruby/object:Gem::Version
629
- version: '0.3'
629
+ version: '0.4'
630
630
  - !ruby/object:Gem::Dependency
631
631
  name: simctl
632
632
  requirement: !ruby/object:Gem::Requirement
@@ -999,6 +999,8 @@ files:
999
999
  - fastlane/lib/assets/DefaultFastfileTemplate
1000
1000
  - fastlane/lib/assets/DefaultFastfileTemplate.swift
1001
1001
  - fastlane/lib/assets/TeamTable.md.erb
1002
+ - fastlane/lib/assets/certificates/AppleIncRootCertificate.cer
1003
+ - fastlane/lib/assets/certificates/AppleRootCA-G3.cer
1002
1004
  - fastlane/lib/assets/completions/completion.bash
1003
1005
  - fastlane/lib/assets/completions/completion.fish
1004
1006
  - fastlane/lib/assets/completions/completion.sh
@@ -1128,10 +1130,10 @@ files:
1128
1130
  - fastlane/lib/fastlane/actions/hg_commit_version_bump.rb
1129
1131
  - fastlane/lib/fastlane/actions/hg_ensure_clean_status.rb
1130
1132
  - fastlane/lib/fastlane/actions/hg_push.rb
1131
- - fastlane/lib/fastlane/actions/hockey.rb
1132
1133
  - fastlane/lib/fastlane/actions/ifttt.rb
1133
1134
  - fastlane/lib/fastlane/actions/import.rb
1134
1135
  - fastlane/lib/fastlane/actions/import_certificate.rb
1136
+ - fastlane/lib/fastlane/actions/import_from_gem.rb
1135
1137
  - fastlane/lib/fastlane/actions/import_from_git.rb
1136
1138
  - fastlane/lib/fastlane/actions/increment_build_number.rb
1137
1139
  - fastlane/lib/fastlane/actions/increment_version_number.rb
@@ -1224,7 +1226,6 @@ files:
1224
1226
  - fastlane/lib/fastlane/actions/trainer.rb
1225
1227
  - fastlane/lib/fastlane/actions/tryouts.rb
1226
1228
  - fastlane/lib/fastlane/actions/twitter.rb
1227
- - fastlane/lib/fastlane/actions/typetalk.rb
1228
1229
  - fastlane/lib/fastlane/actions/unlock_keychain.rb
1229
1230
  - fastlane/lib/fastlane/actions/update_app_age_rating.rb
1230
1231
  - fastlane/lib/fastlane/actions/update_app_group_identifiers.rb
@@ -1432,6 +1433,7 @@ files:
1432
1433
  - fastlane_core/lib/fastlane_core/provisioning_profile.rb
1433
1434
  - fastlane_core/lib/fastlane_core/queue_worker.rb
1434
1435
  - fastlane_core/lib/fastlane_core/secrets.rb
1436
+ - fastlane_core/lib/fastlane_core/stored_passwords.rb
1435
1437
  - fastlane_core/lib/fastlane_core/string_filters.rb
1436
1438
  - fastlane_core/lib/fastlane_core/swag.rb
1437
1439
  - fastlane_core/lib/fastlane_core/tag_version.rb
@@ -1888,6 +1890,7 @@ metadata:
1888
1890
  changelog_uri: https://github.com/fastlane/fastlane/releases
1889
1891
  documentation_uri: https://docs.fastlane.tools/
1890
1892
  homepage_uri: https://fastlane.tools
1893
+ rubygems_mfa_required: 'true'
1891
1894
  source_code_uri: https://github.com/fastlane/fastlane
1892
1895
  rdoc_options: []
1893
1896
  require_paths:
@@ -1,400 +0,0 @@
1
- module Fastlane
2
- module Actions
3
- module SharedValues
4
- HOCKEY_DOWNLOAD_LINK = :HOCKEY_DOWNLOAD_LINK
5
- HOCKEY_BUILD_INFORMATION = :HOCKEY_BUILD_INFORMATION # contains all keys/values from the HockeyApp API, like :title, :bundle_identifier
6
- end
7
-
8
- # rubocop:disable Metrics/ClassLength
9
- class HockeyAction < Action
10
- def self.connection(options)
11
- require 'faraday'
12
- require 'faraday/multipart'
13
- require 'faraday/follow_redirects'
14
-
15
- base_url = options.delete(:bypass_cdn) ? "https://rink.hockeyapp.net" : "https://upload.hockeyapp.net"
16
- foptions = {
17
- url: base_url
18
- }
19
- Faraday.new(foptions) do |builder|
20
- builder.request(:multipart)
21
- builder.request(:url_encoded)
22
- builder.response(:json, content_type: /\bjson$/)
23
- builder.response(:follow_redirects)
24
- builder.adapter(:net_http)
25
- end
26
- end
27
-
28
- def self.upload(api_token, ipa, options)
29
- create_update = options.delete(:create_update)
30
-
31
- if create_update
32
- self.create_and_update_build(api_token, ipa, options)
33
- else
34
- self.upload_build(api_token, ipa, options)
35
- end
36
- end
37
-
38
- # Uses https://support.hockeyapp.net/kb/api/api-versions#upload-version if a `public_identifier` was specified
39
- # otherwise https://support.hockeyapp.net/kb/api/api-apps#upload-app
40
- def self.upload_build(api_token, ipa, options)
41
- connection = self.connection(options)
42
-
43
- options[:ipa] = Faraday::UploadIO.new(ipa, 'application/octet-stream') if ipa && File.exist?(ipa)
44
-
45
- dsym_filename = options.delete(:dsym_filename)
46
- if dsym_filename
47
- options[:dsym] = Faraday::UploadIO.new(dsym_filename, 'application/octet-stream')
48
- end
49
-
50
- connection.post do |req|
51
- req.options.timeout = options.delete(:timeout)
52
- if options[:public_identifier].nil?
53
- req.url("/api/2/apps/upload")
54
- else
55
- req.url("/api/2/apps/#{options.delete(:public_identifier)}/app_versions/upload")
56
- end
57
- req.headers['X-HockeyAppToken'] = api_token
58
- req.body = options
59
- end
60
- end
61
-
62
- # Uses https://support.hockeyapp.net/kb/api/api-versions#create-version
63
- # and https://support.hockeyapp.net/kb/api/api-versions#update-version
64
- # to upload a build
65
- def self.create_and_update_build(api_token, ipa, options)
66
- [:public_identifier, :bundle_short_version, :bundle_version].each do |key|
67
- UI.user_error!("To use the 'create_update' upload mechanism you need to pass the '#{key.to_sym}' option.") unless options[key]
68
- end
69
- # https://support.hockeyapp.net/discussions/problems/33355-is-uploadhockeyappnet-available-for-general-use
70
- # GET requests are cached on CDN, so bypass it
71
- options[:bypass_cdn] = true
72
- connection = self.connection(options)
73
-
74
- options.delete(:ipa)
75
- options.delete(:apk)
76
- app_id = options.delete(:public_identifier)
77
-
78
- ipaio = Faraday::UploadIO.new(ipa, 'application/octet-stream') if ipa && File.exist?(ipa)
79
- dsym = options.delete(:dsym)
80
-
81
- if dsym
82
- dsym_io = Faraday::UploadIO.new(dsym, 'application/octet-stream') if dsym && File.exist?(dsym)
83
- end
84
-
85
- # https://support.hockeyapp.net/discussions/problems/83559
86
- # Should not set status to "2" (downloadable) until after the app is uploaded, so allow the caller
87
- # to specify a different status for the `create` step
88
- update_status = options[:status]
89
- options[:status] = options[:create_status]
90
-
91
- response = connection.get do |req|
92
- req.url("/api/2/apps/#{app_id}/app_versions/new")
93
- req.headers['X-HockeyAppToken'] = api_token
94
- req.body = options
95
- end
96
-
97
- case response.status
98
- when 200...300
99
- app_version_id = response.body['id']
100
- UI.message("successfully created version with id #{app_version_id}")
101
- else
102
- UI.user_error!("Error trying to create app version: #{response.status} - #{response.body}")
103
- end
104
-
105
- options[:ipa] = ipaio
106
-
107
- if dsym
108
- options[:dsym] = dsym_io
109
- end
110
-
111
- options[:status] = update_status
112
-
113
- connection.put do |req|
114
- req.options.timeout = options.delete(:timeout)
115
- req.url("/api/2/apps/#{app_id}/app_versions/#{app_version_id}")
116
- req.headers['X-HockeyAppToken'] = api_token
117
- req.body = options
118
- end
119
- end
120
-
121
- def self.run(options)
122
- build_file = [
123
- options[:ipa],
124
- options[:apk]
125
- ].detect { |e| !e.to_s.empty? }
126
-
127
- if options[:dsym]
128
- dsym_filename = options[:dsym]
129
- else
130
-
131
- if build_file.nil?
132
- UI.user_error!("You have to provide a build file (params 'apk' or 'ipa')")
133
- end
134
-
135
- if options[:ipa].to_s.end_with?(".ipa")
136
- dsym_path = options[:ipa].to_s.gsub('.ipa', '.app.dSYM.zip')
137
- if File.exist?(dsym_path)
138
- dsym_filename = dsym_path
139
- else
140
- UI.important("Symbols not found on path #{File.expand_path(dsym_path)}. Crashes won't be symbolicated properly")
141
- dsym_filename = nil
142
- end
143
- end
144
- end
145
-
146
- UI.user_error!("Symbols on path '#{File.expand_path(dsym_filename)}' not found") if dsym_filename && !File.exist?(dsym_filename)
147
-
148
- if options[:upload_dsym_only]
149
- UI.success('Starting with dSYM upload to HockeyApp... this could take some time.')
150
- else
151
- UI.success('Starting with file(s) upload to HockeyApp... this could take some time.')
152
- end
153
-
154
- values = options.values
155
- values[:dsym_filename] = dsym_filename
156
- values[:notes_type] = options[:notes_type]
157
-
158
- api_token = values.delete(:api_token)
159
-
160
- values.delete_if { |k, v| v.nil? }
161
-
162
- return values if Helper.test?
163
-
164
- ipa_filename = build_file
165
- ipa_filename = nil if options[:upload_dsym_only]
166
-
167
- response = self.upload(api_token, ipa_filename, values)
168
- case response.status
169
- when 200...300
170
- url = response.body['public_url']
171
-
172
- Actions.lane_context[SharedValues::HOCKEY_DOWNLOAD_LINK] = url
173
- Actions.lane_context[SharedValues::HOCKEY_BUILD_INFORMATION] = response.body
174
-
175
- UI.message("Public Download URL: #{url}") if url
176
- UI.success('Build successfully uploaded to HockeyApp!')
177
- else
178
- if response.body.to_s.include?("App could not be created")
179
- UI.user_error!("Hockey has an issue processing this app. Please confirm that an app in Hockey matches this IPA's bundle ID or that you are using the correct API upload token. If error persists, please provide the :public_identifier option from the HockeyApp website. More information https://github.com/fastlane/fastlane/issues/400")
180
- else
181
- UI.user_error!("Error when trying to upload file(s) to HockeyApp: #{response.status} - #{response.body}")
182
- end
183
- end
184
- end
185
-
186
- def self.description
187
- "Refer to [App Center](https://github.com/Microsoft/fastlane-plugin-appcenter/)"
188
- end
189
-
190
- def self.available_options
191
- [
192
- FastlaneCore::ConfigItem.new(key: :apk,
193
- env_name: "FL_HOCKEY_APK",
194
- description: "Path to your APK file",
195
- default_value: Actions.lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH],
196
- default_value_dynamic: true,
197
- optional: true,
198
- verify_block: proc do |value|
199
- UI.user_error!("Couldn't find apk file at path '#{value}'") unless File.exist?(value)
200
- end,
201
- conflicting_options: [:ipa],
202
- conflict_block: proc do |value|
203
- UI.user_error!("You can't use 'apk' and '#{value.key}' options in one run")
204
- end),
205
- FastlaneCore::ConfigItem.new(key: :api_token,
206
- env_name: "FL_HOCKEY_API_TOKEN",
207
- sensitive: true,
208
- description: "API Token for Hockey Access",
209
- verify_block: proc do |value|
210
- UI.user_error!("No API token for Hockey given, pass using `api_token: 'token'`") unless value && !value.empty?
211
- end),
212
- FastlaneCore::ConfigItem.new(key: :ipa,
213
- env_name: "FL_HOCKEY_IPA",
214
- description: "Path to your IPA file. Optional if you use the _gym_ or _xcodebuild_ action. For Mac zip the .app. For Android provide path to .apk file. In addition you could use this to upload .msi, .zip, .pkg, etc if you use the 'create_update' mechanism",
215
- default_value: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH],
216
- default_value_dynamic: true,
217
- optional: true,
218
- verify_block: proc do |value|
219
- UI.user_error!("Couldn't find ipa file at path '#{value}'") unless File.exist?(value)
220
- end,
221
- conflicting_options: [:apk],
222
- conflict_block: proc do |value|
223
- UI.user_error!("You can't use 'ipa' and '#{value.key}' options in one run")
224
- end),
225
- FastlaneCore::ConfigItem.new(key: :dsym,
226
- env_name: "FL_HOCKEY_DSYM",
227
- description: "Path to your symbols file. For iOS and Mac provide path to app.dSYM.zip. For Android provide path to mappings.txt file",
228
- default_value: Actions.lane_context[SharedValues::DSYM_OUTPUT_PATH],
229
- default_value_dynamic: true,
230
- optional: true),
231
- FastlaneCore::ConfigItem.new(key: :create_update,
232
- env_name: "FL_HOCKEY_CREATE_UPDATE",
233
- description: "Set true if you want to create then update your app as opposed to just upload it."\
234
- " You will need the 'public_identifier', 'bundle_version' and 'bundle_short_version'",
235
- type: Boolean,
236
- default_value: false),
237
- FastlaneCore::ConfigItem.new(key: :notes,
238
- env_name: "FL_HOCKEY_NOTES",
239
- description: "Beta Notes",
240
- default_value: Actions.lane_context[SharedValues::FL_CHANGELOG] || "No changelog given",
241
- default_value_dynamic: true),
242
- FastlaneCore::ConfigItem.new(key: :notify,
243
- env_name: "FL_HOCKEY_NOTIFY",
244
- description: "Notify testers? \"1\" for yes",
245
- default_value: "1"),
246
- FastlaneCore::ConfigItem.new(key: :status,
247
- env_name: "FL_HOCKEY_STATUS",
248
- description: "Download status: \"1\" = No user can download; \"2\" = Available for download (only possible with full-access token)",
249
- default_value: "2"),
250
- FastlaneCore::ConfigItem.new(key: :create_status,
251
- env_name: "FL_HOCKEY_CREATE_STATUS",
252
- description: "Download status for initial version creation when create_update is true: \"1\" = No user can download; \"2\" = Available for download (only possible with full-access token)",
253
- default_value: "2"),
254
- FastlaneCore::ConfigItem.new(key: :notes_type,
255
- env_name: "FL_HOCKEY_NOTES_TYPE",
256
- description: "Notes type for your :notes, \"0\" = Textile, \"1\" = Markdown (default)",
257
- default_value: "1"),
258
- FastlaneCore::ConfigItem.new(key: :release_type,
259
- env_name: "FL_HOCKEY_RELEASE_TYPE",
260
- description: "Release type of the app: \"0\" = Beta (default), \"1\" = Store, \"2\" = Alpha, \"3\" = Enterprise",
261
- default_value: "0"),
262
- FastlaneCore::ConfigItem.new(key: :mandatory,
263
- env_name: "FL_HOCKEY_MANDATORY",
264
- description: "Set to \"1\" to make this update mandatory",
265
- default_value: "0"),
266
- FastlaneCore::ConfigItem.new(key: :teams,
267
- env_name: "FL_HOCKEY_TEAMS",
268
- description: "Comma separated list of team ID numbers to which this build will be restricted",
269
- optional: true),
270
- FastlaneCore::ConfigItem.new(key: :users,
271
- env_name: "FL_HOCKEY_USERS",
272
- description: "Comma separated list of user ID numbers to which this build will be restricted",
273
- optional: true),
274
- FastlaneCore::ConfigItem.new(key: :tags,
275
- env_name: "FL_HOCKEY_TAGS",
276
- description: "Comma separated list of tags which will receive access to the build",
277
- optional: true),
278
- FastlaneCore::ConfigItem.new(key: :bundle_short_version,
279
- env_name: "FL_HOCKEY_BUNDLE_SHORT_VERSION",
280
- description: "The bundle_short_version of your application, required when using `create_update`",
281
- optional: true),
282
- FastlaneCore::ConfigItem.new(key: :bundle_version,
283
- env_name: "FL_HOCKEY_BUNDLE_VERSION",
284
- description: "The bundle_version of your application, required when using `create_update`",
285
- optional: true),
286
- FastlaneCore::ConfigItem.new(key: :public_identifier,
287
- env_name: "FL_HOCKEY_PUBLIC_IDENTIFIER",
288
- description: "App id of the app you are targeting, usually you won't need this value. Required, if `upload_dsym_only` set to `true`",
289
- optional: true),
290
- FastlaneCore::ConfigItem.new(key: :commit_sha,
291
- env_name: "FL_HOCKEY_COMMIT_SHA",
292
- description: "The Git commit SHA for this build",
293
- optional: true),
294
- FastlaneCore::ConfigItem.new(key: :repository_url,
295
- env_name: "FL_HOCKEY_REPOSITORY_URL",
296
- description: "The URL of your source repository",
297
- optional: true),
298
- FastlaneCore::ConfigItem.new(key: :build_server_url,
299
- env_name: "FL_HOCKEY_BUILD_SERVER_URL",
300
- description: "The URL of the build job on your build server",
301
- optional: true),
302
- FastlaneCore::ConfigItem.new(key: :upload_dsym_only,
303
- env_name: "FL_HOCKEY_UPLOAD_DSYM_ONLY",
304
- description: "Flag to upload only the dSYM file to hockey app",
305
- type: Boolean,
306
- default_value: false),
307
- FastlaneCore::ConfigItem.new(key: :owner_id,
308
- env_name: "FL_HOCKEY_OWNER_ID",
309
- description: "ID for the owner of the app",
310
- optional: true),
311
- FastlaneCore::ConfigItem.new(key: :strategy,
312
- env_name: "FL_HOCKEY_STRATEGY",
313
- description: "Strategy: 'add' = to add the build as a new build even if it has the same build number (default); 'replace' = to replace a build with the same build number",
314
- default_value: "add",
315
- verify_block: proc do |value|
316
- UI.user_error!("Invalid value '#{value}' for key 'strategy'. Allowed values are 'add', 'replace'.") unless ['add', 'replace'].include?(value)
317
- end),
318
- FastlaneCore::ConfigItem.new(key: :timeout,
319
- env_name: "FL_HOCKEY_TIMEOUT",
320
- description: "Request timeout in seconds",
321
- type: Integer,
322
- optional: true),
323
- FastlaneCore::ConfigItem.new(key: :bypass_cdn,
324
- env_name: "FL_HOCKEY_BYPASS_CDN",
325
- description: "Flag to bypass Hockey CDN when it uploads successfully but reports error",
326
- type: Boolean,
327
- default_value: false),
328
- FastlaneCore::ConfigItem.new(key: :dsa_signature,
329
- env_name: "FL_HOCKEY_DSA_SIGNATURE",
330
- description: "DSA signature for sparkle updates for macOS",
331
- default_value: "",
332
- optional: true)
333
- ]
334
- end
335
-
336
- def self.output
337
- [
338
- ['HOCKEY_DOWNLOAD_LINK', 'The newly generated download link for this build'],
339
- ['HOCKEY_BUILD_INFORMATION', 'contains all keys/values from the HockeyApp API, like :title, :bundle_identifier']
340
- ]
341
- end
342
-
343
- def self.author
344
- ["KrauseFx", "modzelewski", "lacostej"]
345
- end
346
-
347
- def self.is_supported?(platform)
348
- true
349
- end
350
-
351
- def self.details
352
- [
353
- "HockeyApp will be no longer supported and will be transitioned into App Center on November 16, 2019.",
354
- "Please migrate over to [App Center](https://github.com/Microsoft/fastlane-plugin-appcenter/)",
355
- "",
356
- "Symbols will also be uploaded automatically if a `app.dSYM.zip` file is found next to `app.ipa`. In case it is located in a different place you can specify the path explicitly in the `:dsym` parameter.",
357
- "More information about the available options can be found in the [HockeyApp Docs](http://support.hockeyapp.net/kb/api/api-versions#upload-version)."
358
- ].join("\n")
359
- end
360
-
361
- def self.example_code
362
- [
363
- 'hockey(
364
- api_token: "...",
365
- ipa: "./app.ipa",
366
- notes: "Changelog"
367
- )',
368
- 'hockey(
369
- api_token: "...",
370
- create_update: true,
371
- public_identifier: "....",
372
- bundle_short_version: "1.0.2",
373
- bundle_version: "1.0.2.145",
374
- ipa: "./my.msi",
375
- notes: "Changelog"
376
- )',
377
- '# You can bypass the CDN if you are uploading to Hockey and receive an SSL error (which can happen on corporate firewalls)
378
- hockey(
379
- api_token: "...",
380
- ipa: "./app.ipa",
381
- notes: "Changelog",
382
- bypass_cdn: true
383
- )'
384
- ]
385
- end
386
-
387
- def self.category
388
- :deprecated
389
- end
390
-
391
- def self.deprecated_notes
392
- [
393
- "HockeyApp will be no longer supported and will be transitioned into App Center on November 16, 2019.",
394
- "Please migrate over to [App Center](https://github.com/Microsoft/fastlane-plugin-appcenter/)"
395
- ].join("\n")
396
- end
397
- end
398
- # rubocop:enable Metrics/ClassLength
399
- end
400
- end