Class: Fastlane::Actions::RustorePublishAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



7
8
9
# File 'lib/fastlane/plugin/rustore/actions/rustore_publish_action.rb', line 7

def self.authors
  ["Vladislav Onishchenko"]
end

.available_optionsObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/fastlane/plugin/rustore/actions/rustore_publish_action.rb', line 38

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :package_name,
                                 env_name: "RUSTORE_PACKAGE_NAME",
                                 description: "пакет приложения, например `com.example.example`",
                                 optional: false),
    FastlaneCore::ConfigItem.new(key: :key_id,
                                 env_name: "RUSTORE_KEY_ID",
                                 description: "идентификатор приватного ключа в русторе",
                                 optional: false),
    FastlaneCore::ConfigItem.new(key: :private_key,
                                 env_name: "RUSTORE_PRIVATE_KEY",
                                 description: "приватный ключ в русторе",
                                 optional: false),
    FastlaneCore::ConfigItem.new(key: :publish_type,
                                 env_name: "RUSTORE_PUBLISH_TYPE",
                                 description: "Тип публикации (MANUAL, DELAYED, INSTANTLY). По умолчанию - INSTANTLY",
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :gms_apk,
                                 env_name: "RUSTORE_GMS_APK",
                                 description: "путь до апк с гуглсервисами",
                                 optional: false),
    FastlaneCore::ConfigItem.new(key: :hms_apk,
                                 env_name: "RUSTORE_HMS_APK",
                                 description: "путь до апк с хуавейсервисами (опционально)",
                                 optional: true)
  ]
end

.descriptionObject



11
12
13
# File 'lib/fastlane/plugin/rustore/actions/rustore_publish_action.rb', line 11

def self.description
  "Rustore fastlane integration plugin"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


67
68
69
# File 'lib/fastlane/plugin/rustore/actions/rustore_publish_action.rb', line 67

def self.is_supported?(platform)
  [:android].include?(platform)
end

.run(params) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/fastlane/plugin/rustore/actions/rustore_publish_action.rb', line 15

def self.run(params)
  package_name = params[:package_name]
  key_id = params[:key_id]
  private_key = params[:private_key]
  publish_type = params[:publish_type]
  gms_apk = params[:gms_apk]
  hms_apk = params[:hms_apk]

  # Получение токена
  token = Helper::RustoreHelper.get_token(key_id: key_id, private_key: private_key)
  # Создание черновика
  draft_id = Helper::RustoreHelper.create_draft(token, package_name, publish_type)
  # Загрузка апк
  Helper::RustoreHelper.upload_apk(token, draft_id, false, gms_apk, package_name)
  # Если путь до хмс передали, то и его заливаем
  unless hms_apk.nil?
    Helper::RustoreHelper.upload_apk(token, draft_id, true, hms_apk, package_name)
  end
  # Отправка на модерацию
  Helper::RustoreHelper.commit_version(token, draft_id, package_name)

end