class Fastlane::Actions::RavenAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/raven/actions/raven_action.rb, line 35
def self.authors
  ["Marten Klitzke"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/raven/actions/raven_action.rb, line 46
def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :token,
      env_name: "RAVEN_SENTRY_TOKEN",
      description: "A valid Sentry API Token",
      optional: false,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :organization,
      env_name: "RAVEN_SENTRY_ORG",
      description: "Your Sentry Organization name",
      optional: false,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :project,
      env_name: "RAVEN_SENTRY_PROJECT",
      description: "Your Sentry Project name",
      optional: false,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :version,
      env_name: "RAVEN_SENTRY_VERSION",
      description: "The Version of the new Release",
      optional: false,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :sourcemaps,
      env_name: "RAVEN_SENTRY_SOURCEMAPS",
      description: "Path to the Sourcemaps",
      optional: false,
      type: Array
    ),
    FastlaneCore::ConfigItem.new(
      key: :filename_prefix,
      env_name: "RAVEN_SENTRY_FILENAME_PREFIX",
      description: "Prefix for the Sourcemaps Files",
      optional: true,
      type: String
    )
  ]
end
description() click to toggle source
# File lib/fastlane/plugin/raven/actions/raven_action.rb, line 31
def self.description
  "Create new Sentry/Raven Release and Upload Sourcemaps"
end
details() click to toggle source
# File lib/fastlane/plugin/raven/actions/raven_action.rb, line 43
def self.details
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/raven/actions/raven_action.rb, line 93
def self.is_supported?(platform)
  true
end
return_value() click to toggle source
# File lib/fastlane/plugin/raven/actions/raven_action.rb, line 39
def self.return_value
  # If your method provides a return value, you can describe here what it does
end
run(params) click to toggle source
# File lib/fastlane/plugin/raven/actions/raven_action.rb, line 6
def self.run(params)
  client = Sentry::Client.new(params[:token], "#{params[:organization]}/#{params[:project]}")
  UI.message("Creating new Release")
  response = client.create_release(params[:version])
  if response.response_code == 200
    UI.message("Release already exists..")
  elsif response.response_code == 201
    UI.success("Created new Release for Version: #{params[:version]}")
  else
    UI.user_error!("Failed to lookup/create a new Release")
  end
  UI.message("Uploading Sourcemaps")

  params[:sourcemaps].each do |sourcemap|
    response = client.upload_release_artifact(params[:version], sourcemap, params[:filename_prefix])
    if (200..300).cover?(response.response_code)
      UI.success("Uploaded all Sourcemaps for Version: #{params[:version]}")
    elsif (301..499).cover?(response.response_code)
      UI.message("Sourcemaps allready present for Version: #{params[:version]}")
    else
      UI.user_error!("Failed to upload Sourcemaps for Version: #{params[:version]}")
    end
  end
end