Class: Fastlane::Actions::SentryUploadFileAction

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

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



75
76
77
# File 'lib/fastlane/plugin/sentry/actions/sentry_upload_file.rb', line 75

def self.authors
  ["wschurman"]
end

.available_optionsObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/fastlane/plugin/sentry/actions/sentry_upload_file.rb', line 44

def self.available_options
  Helper::SentryConfig.common_api_config_items + [
    FastlaneCore::ConfigItem.new(key: :version,
                                 description: "Release version on Sentry"),
    FastlaneCore::ConfigItem.new(key: :app_identifier,
                                 short_option: "-a",
                                 env_name: "SENTRY_APP_IDENTIFIER",
                                 description: "App Bundle Identifier, prepended to version",
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :build,
                                 short_option: "-b",
                                 description: "Release build on Sentry",
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :dist,
                                 description: "Distribution in release",
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :file,
                                 description: "Path to the file to upload",
                                 verify_block: proc do |value|
                                   UI.user_error! "Could not find file at path '#{value}'" unless File.exist?(value)
                                 end),
    FastlaneCore::ConfigItem.new(key: :file_url,
                                 description: "Optional URL we should associate with the file",
                                 optional: true)
  ]
end

.descriptionObject



33
34
35
# File 'lib/fastlane/plugin/sentry/actions/sentry_upload_file.rb', line 33

def self.description
  "Upload files to a release of a project on Sentry"
end

.detailsObject



37
38
39
40
41
42
# File 'lib/fastlane/plugin/sentry/actions/sentry_upload_file.rb', line 37

def self.details
  [
    "This action allows you to upload files to a release of a project on Sentry.",
    "See https://docs.sentry.io/learn/cli/releases/#upload-files for more information."
  ].join(" ")
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


79
80
81
# File 'lib/fastlane/plugin/sentry/actions/sentry_upload_file.rb', line 79

def self.is_supported?(platform)
  true
end

.return_valueObject



71
72
73
# File 'lib/fastlane/plugin/sentry/actions/sentry_upload_file.rb', line 71

def self.return_value
  nil
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
# File 'lib/fastlane/plugin/sentry/actions/sentry_upload_file.rb', line 4

def self.run(params)
  require 'shellwords'

  Helper::SentryConfig.parse_api_params(params)

  version = params[:version]
  version = "#{params[:app_identifier]}@#{params[:version]}" if params[:app_identifier]
  version = "#{version}+#{params[:build]}" if params[:build]

  file = params[:file]

  command = [
    "releases",
    "files",
    version,
    "upload",
    file
  ]
  command.push(params[:file_url]) unless params[:file_url].nil?
  command.push("--dist").push(params[:dist]) unless params[:dist].nil?

  Helper::SentryHelper.call_sentry_cli(params, command)
  UI.success("Successfully uploaded files to release: #{version}")
end