Method: Fastlane::Actions::HockeyAction.create_and_update_build
- Defined in:
- fastlane/lib/fastlane/actions/hockey.rb
.create_and_update_build(api_token, ipa, options) ⇒ Object
Uses support.hockeyapp.net/kb/api/api-versions#create-version and support.hockeyapp.net/kb/api/api-versions#update-version to upload a build
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'fastlane/lib/fastlane/actions/hockey.rb', line 64 def self.create_and_update_build(api_token, ipa, ) [:public_identifier, :bundle_short_version, :bundle_version].each do |key| UI.user_error!("To use the 'create_update' upload mechanism you need to pass the '#{key.to_sym}' option.") unless [key] end # https://support.hockeyapp.net/discussions/problems/33355-is-uploadhockeyappnet-available-for-general-use # GET requests are cached on CDN, so bypass it [:bypass_cdn] = true connection = self.connection() .delete(:ipa) .delete(:apk) app_id = .delete(:public_identifier) ipaio = Faraday::UploadIO.new(ipa, 'application/octet-stream') if ipa && File.exist?(ipa) dsym = .delete(:dsym) if dsym dsym_io = Faraday::UploadIO.new(dsym, 'application/octet-stream') if dsym && File.exist?(dsym) end # https://support.hockeyapp.net/discussions/problems/83559 # Should not set status to "2" (downloadable) until after the app is uploaded, so allow the caller # to specify a different status for the `create` step update_status = [:status] [:status] = [:create_status] response = connection.get do |req| req.url("/api/2/apps/#{app_id}/app_versions/new") req.headers['X-HockeyAppToken'] = api_token req.body = end case response.status when 200...300 app_version_id = response.body['id'] UI.("successfully created version with id #{app_version_id}") else UI.user_error!("Error trying to create app version: #{response.status} - #{response.body}") end [:ipa] = ipaio if dsym [:dsym] = dsym_io end [:status] = update_status connection.put do |req| req..timeout = .delete(:timeout) req.url("/api/2/apps/#{app_id}/app_versions/#{app_version_id}") req.headers['X-HockeyAppToken'] = api_token req.body = end end |