class Fastlane::Actions::BuildAndUploadToAppetizeAction

Public Class Methods

authors() click to toggle source
# File fastlane/lib/fastlane/actions/build_and_upload_to_appetize.rb, line 96
def self.authors
  ["KrauseFx"]
end
available_options() click to toggle source
# File fastlane/lib/fastlane/actions/build_and_upload_to_appetize.rb, line 50
def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :xcodebuild,
                                 description: "Parameters that are passed to the xcodebuild action",
                                 type: Hash,
                                 default_value: {},
                                 short_option: '-x',
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :scheme,
                                 description: "The scheme to build. Can also be passed using the `xcodebuild` parameter",
                                 type: String,
                                 short_option: '-s',
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :api_token,
                                 env_name: "APPETIZE_API_TOKEN",
                                 description: "Appetize.io API Token",
                                 sensitive: true,
                                 code_gen_sensitive: true),
    FastlaneCore::ConfigItem.new(key: :public_key,
                                 description: "If not provided, a new app will be created. If provided, the existing build will be overwritten",
                                 optional: true,
                                 verify_block: proc do |value|
                                   if value.start_with?("private_")
                                     UI.user_error!("You provided a private key to appetize, please provide the public key")
                                   end
                                 end),
    FastlaneCore::ConfigItem.new(key: :note,
                                 description: "Notes you wish to add to the uploaded app",
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :timeout,
                                 description: "The number of seconds to wait until automatically ending the session due to user inactivity. Must be 30, 60, 90, 120, 180, 300, 600, 1800, 3600 or 7200. Default is 120",
                                 type: Integer,
                                 optional: true,
                                 verify_block: proc do |value|
                                   UI.user_error!("The value provided doesn't match any of the supported options.") unless [30, 60, 90, 120, 180, 300, 600, 1800, 3600, 7200].include?(value)
                                 end)
  ]
end
category() click to toggle source
# File fastlane/lib/fastlane/actions/build_and_upload_to_appetize.rb, line 108
def self.category
  :misc
end
description() click to toggle source

@!group Documentation

# File fastlane/lib/fastlane/actions/build_and_upload_to_appetize.rb, line 39
def self.description
  "Generate and upload an ipa file to appetize.io"
end
details() click to toggle source
# File fastlane/lib/fastlane/actions/build_and_upload_to_appetize.rb, line 43
def self.details
  [
    "This should be called from danger.",
    "More information in the [device_grid guide](https://github.com/fastlane/fastlane/blob/master/fastlane/lib/fastlane/actions/device_grid/README.md)."
  ].join("\n")
end
example_code() click to toggle source
# File fastlane/lib/fastlane/actions/build_and_upload_to_appetize.rb, line 104
def self.example_code
  nil
end
is_supported?(platform) click to toggle source
# File fastlane/lib/fastlane/actions/build_and_upload_to_appetize.rb, line 100
def self.is_supported?(platform)
  platform == :ios
end
output() click to toggle source
# File fastlane/lib/fastlane/actions/build_and_upload_to_appetize.rb, line 89
def self.output
end
return_value() click to toggle source
# File fastlane/lib/fastlane/actions/build_and_upload_to_appetize.rb, line 92
def self.return_value
  ""
end
run(params) click to toggle source
# File fastlane/lib/fastlane/actions/build_and_upload_to_appetize.rb, line 4
def self.run(params)
  tmp_path = "/tmp/fastlane_build"

  xcodebuild_configs = params[:xcodebuild]
  xcodebuild_configs[:sdk] = "iphonesimulator"
  xcodebuild_configs[:derivedDataPath] = tmp_path
  xcodebuild_configs[:xcargs] = "CONFIGURATION_BUILD_DIR=" + tmp_path
  xcodebuild_configs[:scheme] ||= params[:scheme] if params[:scheme].to_s.length > 0

  Actions::XcodebuildAction.run(xcodebuild_configs)

  app_path = Dir[File.join(tmp_path, "**", "*.app")].last
  UI.user_error!("Couldn't find app") unless app_path

  zipped_bundle = Actions::ZipAction.run(path: app_path,
                                  output_path: File.join(tmp_path, "Result.zip"))

  other_action.appetize(path: zipped_bundle,
                        api_token: params[:api_token],
                        public_key: params[:public_key],
                        note: params[:note],
                        timeout: params[:timeout])

  public_key = Actions.lane_context[SharedValues::APPETIZE_PUBLIC_KEY]
  UI.success("Generated Public Key: #{Actions.lane_context[SharedValues::APPETIZE_PUBLIC_KEY]}")

  FileUtils.rm_rf(tmp_path)

  return public_key
end