Class: Fastlane::Actions::ShuttleAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/shuttle/actions/shuttle_action.rb

Class Method Summary collapse

Class Method Details

.authorsObject



52
53
54
# File 'lib/fastlane/plugin/shuttle/actions/shuttle_action.rb', line 52

def self.authors
  ["Frédéric Ruaudel <[email protected]>"]
end

.available_optionsObject



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
# File 'lib/fastlane/plugin/shuttle/actions/shuttle_action.rb', line 75

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :package_path,
                            env_name: "SHUTTLE_PACKAGE_PATH",
                         description: "The path to the new app you want to upload to Shuttle ( if not provided, it'll check in shared values GRADLE_APK_OUTPUT_PATH or IPA_OUTPUT_PATH)",
                            optional: true,
                                type: String),
    FastlaneCore::ConfigItem.new(key: :base_url,
                            env_name: "SHUTTLE_BASE_URL",
                         description: "The base url of your Shuttle instance",
                            optional: false,
                                type: String),
    FastlaneCore::ConfigItem.new(key: :access_token,
                            env_name: "SHUTTLE_ACCESS_TOKEN",
                         description: "The access token of your account on Shuttle",
                            optional: false,
                                type: String),
    FastlaneCore::ConfigItem.new(key: :release_name,
                            env_name: "SHUTTLE_RELEASE_NAME",
                         description: "The name of the release (eg. Sprint #14)",
                            optional: true,
                                type: String),
    FastlaneCore::ConfigItem.new(key: :release_notes,
                            env_name: "SHUTTLE_RELEASE_NOTES",
                         description: "The release notes of the release (eg. Bug fixes)",
                            optional: true,
                       default_value: "Bug fixes and improvements",
                                type: String),
    FastlaneCore::ConfigItem.new(key: :env_id,
                            env_name: "SHUTTLE_ENV_ID",
                         description: "The uniq ID of the app's environment you want to publish the build to (if not provided, it will try to guess it or ask to select/create it interactively then display the value so you can set it definitively)",
                            optional: true,
                                type: String),                                      
  ]
end

.descriptionObject



48
49
50
# File 'lib/fastlane/plugin/shuttle/actions/shuttle_action.rb', line 48

def self.description
  "Publish your builds on [Shuttle.tools](https://www.shuttle.tools)"
end

.detailsObject



61
62
63
64
65
66
67
# File 'lib/fastlane/plugin/shuttle/actions/shuttle_action.rb', line 61

def self.details
  # Optional:
  [
    "If you don't know which `env_id` to set, just run the action interactively without `env_id` parameter to force the plugin to fetch available info from your instance or give you the opportunity to create any needed app and environment that would be missing.",
    "Once done, you will get the associated `env_id` in the _Shuttle upload info summary_ table at the end of the script execution. Just add it in your action parameter to make it works reliably next time including in your CI non-interactive environment"
  ].join("\n")
end

.example_codeObject



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/fastlane/plugin/shuttle/actions/shuttle_action.rb', line 111

def self.example_code
  [
    'download_url = shuttle(
      access_token: "...",
      base_url: "https://myInstance.shuttle.tools",
      package_path: "./app.ipa"
    )',
    'shuttle(
      access_token: "...",
      base_url: "https://myInstance.shuttle.tools",
      package_path: "./app.ipa",
      env_id: "UD6VCR-2X7TME-XSMZW6-MNXIR7",
      release_name: "Sprint #14",
      release_notes: "Changelog"
    )'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


129
130
131
132
133
134
135
# File 'lib/fastlane/plugin/shuttle/actions/shuttle_action.rb', line 129

def self.is_supported?(platform)
  # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
  # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
  #
  # [:ios, :mac, :android].include?(platform)
  true
end

.outputObject



69
70
71
72
73
# File 'lib/fastlane/plugin/shuttle/actions/shuttle_action.rb', line 69

def self.output
  [
    ['SHUTTLE_DOWNLOAD_LINK', 'The newly generated download link for this build']
  ]
end

.return_valueObject



56
57
58
59
# File 'lib/fastlane/plugin/shuttle/actions/shuttle_action.rb', line 56

def self.return_value
  # If your method provides a return value, you can describe here what it does
  "Shuttle download link"
end

.run(params) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/fastlane/plugin/shuttle/actions/shuttle_action.rb', line 24

def self.run(params)
  helper = Helper::ShuttleHelper
  selector = Helper::AppEnvironmentSelector
  shuttle_instance = helper.get_shuttle_instance(params)
  package_info = helper.get_app_info(params)
  
  UI.message("Uploading #{package_info.platform_id} package #{package_info.path} with ID #{package_info.id}")

  app_environment = selector.get_app_environment(shuttle_instance, package_info, params)
  
  release = helper.get_release_info(params, app_environment, package_info)

  helper.print_summary_table(shuttle_instance, app_environment, package_info, release)

  release.build = helper.upload_build(shuttle_instance, package_info, app_environment.shuttle_app.id)

  helper.create_release(shuttle_instance, release)

  download_url = helper.download_url(shuttle_instance, app_environment, package_info)
  Actions.lane_context[SharedValues::SHUTTLE_DOWNLOAD_LINK] = download_url

  return download_url
end