Class: Fastlane::Actions::SqCiToolsRuStoreFindOrCreateDraftIdAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



87
88
89
# File 'lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_ru_store_find_or_create_draft_id_action.rb', line 87

def self.authors
  ['Semen Kologrivov']
end

.available_optionsObject



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
# File 'lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_ru_store_find_or_create_draft_id_action.rb', line 49

def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :changelog_path,
      env_name: 'SQ_CI_RU_STORE_CHANGELOG_PATH',
      description: 'Path to .txt-file with version\'s changelog',
      optional: false,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :publish_type,
      env_name: 'SQ_CI_RU_STORE_PUBLISH_TYPE',
      description: 'Version\'s publish type. Available values: MANUAL, INSTANTLY, DELAYED',
      optional: true,
      type: String,
      default_value: 'INSTANTLY'
    ),
    FastlaneCore::ConfigItem.new(
      key: :publish_date_time,
      env_name: 'SQ_CI_RU_STORE_PUBLISH_DATE_TIME',
      description: 'Version\'s publish datetime in format yyyy-MM-dd\'T\'HH:mm:ssXXX. Required for DELAYED publish type',
      optional: true,
      type: String,
      default_value: ''
    )
  ] +
    Options::RuStore.options +
    Options::Shared.options
end

.descriptionObject



41
42
43
# File 'lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_ru_store_find_or_create_draft_id_action.rb', line 41

def self.description
  'Find or create draft id for passed application in RuStore'
end

.detailsObject



45
46
47
# File 'lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_ru_store_find_or_create_draft_id_action.rb', line 45

def self.details
  ''
end

.is_supported?(_) ⇒ Boolean

Returns:

  • (Boolean)


91
92
93
# File 'lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_ru_store_find_or_create_draft_id_action.rb', line 91

def self.is_supported?(_)
  true
end

.return_typeObject



79
80
81
# File 'lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_ru_store_find_or_create_draft_id_action.rb', line 79

def self.return_type
  :integer
end

.return_valueObject



83
84
85
# File 'lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_ru_store_find_or_create_draft_id_action.rb', line 83

def self.return_value
  'Draft identifier'
end

.run(params) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_ru_store_find_or_create_draft_id_action.rb', line 12

def self.run(params)
  token = params[:token]
  package_name = params[:package_name]
  changelog_path = params[:changelog_path]
  publish_type = params[:publish_type]
  publish_date_time = params[:publish_date_time]
  timeout = params[:timeout]

  draft_id = Helper::RuStoreHelper.get_draft_id(
    token: token,
    package_name: package_name,
    timeout: timeout
  )

  if draft_id.nil?
    draft_id = Helper::RuStoreHelper.create_draft(
      token: token,
      package_name: package_name,
      changelog_path: changelog_path,
      publish_type: publish_type,
      publish_date_time: publish_date_time,
      timeout: timeout
    )
  end

  lane_context[SharedValues::SQ_CI_RU_STORE_DRAFT_ID] = draft_id
  return draft_id
end