Class: Fastlane::Actions::UninowSentryUploadFileAction

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

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



72
73
74
# File 'lib/fastlane/plugin/uninow_sentry/actions/uninow_sentry_upload_file.rb', line 72

def self.authors
  ["wschurman"]
end

.available_optionsObject



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

def self.available_options
  Helper::UninowSentryConfig.common_api_config_items + [
    FastlaneCore::ConfigItem.new(key: :version,
                                 description: "Release version on Sentry"),
    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),
    FastlaneCore::ConfigItem.new(key: :app_identifier,
                                short_option: "-a",
                                env_name: "SENTRY_APP_IDENTIFIER",
                                description: "App Bundle Identifier, prepended to version",
                                optional: true)
  ]
end

.descriptionObject



34
35
36
# File 'lib/fastlane/plugin/uninow_sentry/actions/uninow_sentry_upload_file.rb', line 34

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

.detailsObject



38
39
40
41
42
43
# File 'lib/fastlane/plugin/uninow_sentry/actions/uninow_sentry_upload_file.rb', line 38

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)


76
77
78
# File 'lib/fastlane/plugin/uninow_sentry/actions/uninow_sentry_upload_file.rb', line 76

def self.is_supported?(platform)
  true
end

.return_valueObject



68
69
70
# File 'lib/fastlane/plugin/uninow_sentry/actions/uninow_sentry_upload_file.rb', line 68

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
28
# File 'lib/fastlane/plugin/uninow_sentry/actions/uninow_sentry_upload_file.rb', line 4

def self.run(params)
  require 'shellwords'

  Helper::UninowSentryHelper.check_sentry_cli!
  Helper::UninowSentryConfig.parse_api_params(params)

  file = params[:file]

  version = params[:version]
  version = "#{params[:app_identifier]}-#{params[:version]}" if params[:app_identifier]

  command = [
    "sentry-cli",
    "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::UninowSentryHelper.call_sentry_cli(command)
  UI.success("Successfully uploaded files to release: #{version}")
end