Class: Fastlane::Actions::SentryCreateDeployAction

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

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



89
90
91
# File 'lib/fastlane/plugin/sentry/actions/sentry_create_deploy.rb', line 89

def self.authors
  ["denrase"]
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/fastlane/plugin/sentry/actions/sentry_create_deploy.rb', line 45

def self.available_options
  Helper::SentryConfig.common_api_config_items + [
    FastlaneCore::ConfigItem.new(key: :version,
                                 description: "Release version to associate the deploy with on Sentry"),
    FastlaneCore::ConfigItem.new(key: :app_identifier,
                                 short_option: "-a",
                                 env_name: "SENTRY_APP_IDENTIFIER",
                                 description: "App Bundle Identifier, prepended with the version.\nFor example bundle@version",
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :build,
                                 short_option: "-b",
                                 description: "Release build to associate the deploy with on Sentry",
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :env,
                                 short_option: "-e",
                                 description: "Set the environment for this release. This argument is required. Values that make sense here would be 'production' or 'staging'",
                                 optional: false),
    FastlaneCore::ConfigItem.new(key: :name,
                                 short_option: "-n",
                                 description: "Optional human readable name for this deployment",
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :deploy_url,
                                 description: "Optional URL that points to the deployment",
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :started,
                                 description: "Optional unix timestamp when the deployment started",
                                 is_string: false,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :finished,
                                 description: "Optional unix timestamp when the deployment finished",
                                 is_string: false,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :time,
                                 short_option: "-t",
                                 description: "Optional deployment duration in seconds. This can be specified alternatively to `started` and `finished`",
                                 is_string: false,
                                 optional: true)
  ]
end

.descriptionObject



34
35
36
# File 'lib/fastlane/plugin/sentry/actions/sentry_create_deploy.rb', line 34

def self.description
  "Creates a new release deployment for a project on Sentry"
end

.detailsObject



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

def self.details
  [
    "This action allows you to associate deploys to releases for a project on Sentry.",
    "See https://docs.sentry.io/product/cli/releases/#creating-deploys for more information."
  ].join(" ")
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


93
94
95
# File 'lib/fastlane/plugin/sentry/actions/sentry_create_deploy.rb', line 93

def self.is_supported?(platform)
  true
end

.return_valueObject



85
86
87
# File 'lib/fastlane/plugin/sentry/actions/sentry_create_deploy.rb', line 85

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/sentry/actions/sentry_create_deploy.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]

  command = [
    "releases",
    "deploys",
    version,
    "new"
  ]
  command.push('--env').push(params[:env]) unless params[:env].nil?
  command.push('--name').push(params[:name]) unless params[:name].nil?
  command.push('--url').push(params[:deploy_url]) unless params[:deploy_url].nil?
  command.push('--started').push(params[:started]) unless params[:started].nil?
  command.push('--finished').push(params[:finished]) unless params[:finished].nil?
  command.push('--time').push(params[:time]) unless params[:time].nil?

  Helper::SentryHelper.call_sentry_cli(params, command)
  UI.success("Successfully created deploy: #{version}")
end