class Fastlane::Actions::ShuttleAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/shuttle/actions/shuttle_action.rb, line 52
def self.authors
  ["Frédéric Ruaudel <fred@h2g.io>"]
end
available_options() click to toggle source
# 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
description() click to toggle source
# 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
details() click to toggle source
# 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_code() click to toggle source
# 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) click to toggle source
# 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
output() click to toggle source
# 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_value() click to toggle source
# 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) click to toggle source
# 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