Class: Fastlane::Actions::BuildAndUploadToAppetizeAction

Inherits:
Fastlane::Action show all
Defined in:
fastlane/lib/fastlane/actions/build_and_upload_to_appetize.rb

Constant Summary

Constants inherited from Fastlane::Action

Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES

Documentation collapse

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, author, deprecated_notes, lane_context, method_missing, other_action, return_type, sample_return_value, shell_out_should_use_bundle_exec?, step_text

Class Method Details

.authorsObject


75
76
77
# File 'fastlane/lib/fastlane/actions/build_and_upload_to_appetize.rb', line 75

def self.authors
  ["KrauseFx"]
end

.available_optionsObject


47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'fastlane/lib/fastlane/actions/build_and_upload_to_appetize.rb', line 47

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,
                                 is_string: true)
  ]
end

.categoryObject


87
88
89
# File 'fastlane/lib/fastlane/actions/build_and_upload_to_appetize.rb', line 87

def self.category
  :misc
end

.descriptionObject


36
37
38
# File 'fastlane/lib/fastlane/actions/build_and_upload_to_appetize.rb', line 36

def self.description
  "Generate and upload an ipa file to appetize.io"
end

.detailsObject


40
41
42
43
44
45
# File 'fastlane/lib/fastlane/actions/build_and_upload_to_appetize.rb', line 40

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_codeObject


83
84
85
# File 'fastlane/lib/fastlane/actions/build_and_upload_to_appetize.rb', line 83

def self.example_code
  nil
end

.is_supported?(platform) ⇒ Boolean

Returns:


79
80
81
# File 'fastlane/lib/fastlane/actions/build_and_upload_to_appetize.rb', line 79

def self.is_supported?(platform)
  platform == :ios
end

.outputObject


68
69
# File 'fastlane/lib/fastlane/actions/build_and_upload_to_appetize.rb', line 68

def self.output
end

.return_valueObject


71
72
73
# File 'fastlane/lib/fastlane/actions/build_and_upload_to_appetize.rb', line 71

def self.return_value
  ""
end

.run(params) ⇒ Object


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# 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 = 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