fastlane-plugin-rustore 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe19afc2cdc9ed6a3c0e2b3aebf8a4b4a5a2b3726e5194ae41acfc98a6d508c2
|
4
|
+
data.tar.gz: 813c8b0290500934e1c35fe80b5fd4fc0b4ca49479012e787e1614e7e7ad26bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '084ab61cd912af626f83c4452f4bea6848f9621c3be5c4f8ef1304fd9946b138b80d5536794808050b51c741359d51a065a6e1f87a80acfdc7b6edf5c2d34585'
|
7
|
+
data.tar.gz: 9b9838bca439d93c72b9fcac387844edd043aec1a91113264c4ef3dbdcf71791af9cf5ded637517e79ecb9916ce3a46ea01dc225b7fa40d45c0708d4e7e8aed3
|
data/README.md
CHANGED
@@ -1,55 +1,38 @@
|
|
1
|
-
#
|
2
|
-
Fastlane плагин для заливки приложений в Rustore
|
1
|
+
# Fastlane Rustore plugin
|
3
2
|
|
4
|
-
|
3
|
+
[](https://rubygems.org/gems/fastlane-plugin-rustore) [](https://github.com/mkenney/software-guides/blob/master/STABILITY-BADGES.md#work-in-progress)
|
5
4
|
|
6
|
-
[](https://rubygems.org/gems/fastlane-plugin-rustore)
|
7
5
|
|
8
|
-
##
|
6
|
+
## Дисклеймер
|
9
7
|
|
10
|
-
|
8
|
+
Пока что реализован базовый функционал с заливкой апк. Скриншоты, описание и прочие материалы наследуются от предыдущего релиза. Обработки ошибок нет. Если у вас уже есть черновик релиза, то скорей всего ничего не заработает. Черновик, созданный через апи, в админке отображаться не будет. Если случилась ошибка где-то на этапе заливки, то останется черновик, который будет мешать следующему запуску скрипта, удалить его лучше с помощью [питонскрипта](https://github.com/stfbee/python-rustore-api), а экшен удаления тут будет чуть позже.
|
11
9
|
|
10
|
+
## Поехали
|
11
|
+
|
12
|
+
Для начала добавь плагин в ваш fastlane проект:
|
12
13
|
```bash
|
13
14
|
fastlane add_plugin rustore
|
14
15
|
```
|
15
|
-
|
16
|
-
## About rustore
|
17
|
-
|
18
|
-
Rustore fastlane integration
|
19
|
-
|
20
|
-
**Note to author:** Add a more detailed description about this plugin here. If your plugin contains multiple actions, make sure to mention them here.
|
21
|
-
|
22
|
-
## Example
|
23
|
-
|
24
|
-
Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
|
25
|
-
|
26
|
-
**Note to author:** Please set up a sample project to make it easy for users to explore what your plugin does. Provide everything that is necessary to try out the plugin in this project (including a sample Xcode/Android project if necessary)
|
27
|
-
|
28
|
-
## Run tests for this plugin
|
29
|
-
|
30
|
-
To run both the tests, and code style validation, run
|
31
|
-
|
32
|
-
```
|
33
|
-
rake
|
34
|
-
```
|
35
|
-
|
36
|
-
To automatically fix many of the styling issues, use
|
16
|
+
После чего в каком-нибудь лейне дергай экшен плагина:
|
37
17
|
```
|
38
|
-
|
18
|
+
rustore_publish(
|
19
|
+
gms_apk: "../../app-release.apk",
|
20
|
+
hms_apk: "../../app-release-hms.apk",
|
21
|
+
package_name: "com.example.example",
|
22
|
+
publish_type: "MANUAL"
|
23
|
+
company_id: "123123",
|
24
|
+
private_key: "MIIE....."
|
25
|
+
)
|
39
26
|
```
|
40
27
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
## About _fastlane_
|
54
|
-
|
55
|
-
_fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
|
28
|
+
* `gms_apk` - путь до .apk, который лучше скачать с гугл плея, у фастлейна даже есть для этого [инструмент](https://docs.fastlane.tools/actions/download_from_play_store/)
|
29
|
+
* `hms_apk` - путь до .apk с Huawei-сервисами (опционально). У Рустора пока все плохо с документацией об этом, но залить его можно, что получится - пока хз.
|
30
|
+
* `package_name` - название пакета
|
31
|
+
* `publish_type` - тип публикации (MANUAL - ручная, DELAYED - отложенная, INSTANTLY - автоматическая после модерации). По умолчанию - INSTANTLY.
|
32
|
+
* `company_id` и `private_key` надо взять в админке рустора, доступ к ним имеет только оунер.
|
33
|
+
|
34
|
+
## Ссылочки
|
35
|
+
* [_fastlane_](https://github.com/fastlane/fastlane)
|
36
|
+
* [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/)
|
37
|
+
* [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/)
|
38
|
+
* [Rustore API](https://help.rustore.ru/rustore/for_developers/work_with_RuStore_API)
|
@@ -13,19 +13,17 @@ module Fastlane
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.run(params)
|
16
|
-
version_name = params[:version_name]
|
17
16
|
package_name = params[:package_name]
|
18
17
|
company_id = params[:company_id]
|
19
18
|
private_key = params[:private_key]
|
19
|
+
publish_type = params[:publish_type]
|
20
20
|
gms_apk = params[:gms_apk]
|
21
21
|
hms_apk = params[:hms_apk]
|
22
22
|
|
23
23
|
# Получение токена
|
24
24
|
token = Helper::RustoreHelper.get_token(company_id: company_id, private_key: private_key)
|
25
|
-
# Удаление черновика
|
26
|
-
# Helper::RustoreHelper.delete_draft(token, draft_id, package_name)
|
27
25
|
# Создание черновика
|
28
|
-
draft_id = Helper::RustoreHelper.create_draft(token, package_name,
|
26
|
+
draft_id = Helper::RustoreHelper.create_draft(token, package_name, publish_type)
|
29
27
|
# Загрузка апк
|
30
28
|
Helper::RustoreHelper.upload_apk(token, draft_id, false, gms_apk, package_name)
|
31
29
|
# Если путь до хмс передали, то и его заливаем
|
@@ -39,11 +37,6 @@ module Fastlane
|
|
39
37
|
|
40
38
|
def self.available_options
|
41
39
|
[
|
42
|
-
FastlaneCore::ConfigItem.new(key: :version_name,
|
43
|
-
env_name: "RUSTORE_VERSION_NAME",
|
44
|
-
description: "имя версии приложения, например `1.0.0 (102)`",
|
45
|
-
optional: false,
|
46
|
-
type: String),
|
47
40
|
FastlaneCore::ConfigItem.new(key: :package_name,
|
48
41
|
env_name: "RUSTORE_PACKAGE_NAME",
|
49
42
|
description: "пакет приложения, например `com.example.example`",
|
@@ -56,6 +49,10 @@ module Fastlane
|
|
56
49
|
env_name: "RUSTORE_PRIVATE_KEY",
|
57
50
|
description: "приватный ключ в русторе",
|
58
51
|
optional: false),
|
52
|
+
FastlaneCore::ConfigItem.new(key: :publish_type,
|
53
|
+
env_name: "RUSTORE_PUBLISH_TYPE",
|
54
|
+
description: "Тип публикации (MANUAL, DELAYED, INSTANTLY). По умолчанию - INSTANTLY",
|
55
|
+
optional: true),
|
59
56
|
FastlaneCore::ConfigItem.new(key: :gms_apk,
|
60
57
|
env_name: "RUSTORE_GMS_APK",
|
61
58
|
description: "путь до апк с гуглсервисами",
|
@@ -7,13 +7,6 @@ module Fastlane
|
|
7
7
|
|
8
8
|
module Helper
|
9
9
|
class RustoreHelper
|
10
|
-
# class methods that you define here become available in your action
|
11
|
-
# as `Helper::RustoreHelper.your_method`
|
12
|
-
#
|
13
|
-
def self.show_message
|
14
|
-
UI.message("Hello from the rustore plugin helper!")
|
15
|
-
end
|
16
|
-
|
17
10
|
def self.connection
|
18
11
|
require 'faraday'
|
19
12
|
require 'faraday_middleware'
|
@@ -50,30 +43,30 @@ module Fastlane
|
|
50
43
|
req.body = { companyId: company_id, timestamp: timestamp, signature: signature }
|
51
44
|
end
|
52
45
|
|
53
|
-
UI.message("Debug: response #{response.body}")
|
46
|
+
UI.message("Debug: response #{response.body}") if ENV['DEBUG']
|
54
47
|
|
55
48
|
response.body["body"]["jwe"]
|
56
49
|
end
|
57
50
|
|
58
|
-
def self.create_draft(token, package_name,
|
51
|
+
def self.create_draft(token, package_name, publish_type)
|
59
52
|
url = "/public/v1/application/#{package_name}/version"
|
60
53
|
response = connection.post(url) do |req|
|
61
54
|
req.headers['Public-Token'] = token
|
62
|
-
req.body = {
|
55
|
+
req.body = {}
|
56
|
+
req.body['publishType'] = publish_type unless publish_type.nil?
|
63
57
|
end
|
64
58
|
|
65
|
-
UI.message("Debug: response #{response.body}")
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
59
|
+
UI.message("Debug: response #{response.body}") if ENV['DEBUG']
|
60
|
+
if response.body["body"]
|
61
|
+
# Если черновика не было, и мы создали новый, здесь будет draftId
|
62
|
+
return response.body["body"]
|
63
|
+
elsif response.body["message"]
|
64
|
+
# Если черновик уже существовал, в message будет ошибка вида
|
65
|
+
# "You already have draft version with ID = XXXXXXXXXX", откуда достаем ID существующего черновика.
|
66
|
+
return response.body["message"].scan(/\d+/).first.to_i
|
67
|
+
else
|
68
|
+
raise "Couldn't get draftId from RuStore"
|
74
69
|
end
|
75
|
-
|
76
|
-
UI.message("Debug: response #{response.body}")
|
77
70
|
end
|
78
71
|
|
79
72
|
def self.upload_apk(token, draft_id, is_hms, file_path, package_name)
|
@@ -86,15 +79,21 @@ module Fastlane
|
|
86
79
|
end
|
87
80
|
|
88
81
|
url = "/public/v1/application/#{package_name}/version/#{draft_id}/apk"
|
89
|
-
payload = {
|
82
|
+
payload = {}
|
90
83
|
payload[:file] = Faraday::Multipart::FilePart.new(file_path, 'application/vnd.android.package-archive')
|
91
84
|
|
92
85
|
response = connection.post(url) do |req|
|
93
86
|
req.headers['Public-Token'] = token
|
87
|
+
req.params['servicesType'] = apk_type
|
88
|
+
req.params['isMainApk'] = is_main
|
94
89
|
req.body = payload
|
95
90
|
end
|
96
91
|
|
97
|
-
|
92
|
+
if response.body["message"] == "File was not uploaded successfully: The code of this version must be larger than that of the previous one"
|
93
|
+
raise "Build with this version code was already uploaded earlier"
|
94
|
+
end
|
95
|
+
|
96
|
+
UI.message("Debug: response #{response.body}") if ENV['DEBUG']
|
98
97
|
end
|
99
98
|
|
100
99
|
def self.commit_version(token, draft_id, package_name)
|
@@ -103,9 +102,8 @@ module Fastlane
|
|
103
102
|
req.headers['Public-Token'] = token
|
104
103
|
end
|
105
104
|
|
106
|
-
UI.message("Debug: response #{response.body}")
|
105
|
+
UI.message("Debug: response #{response.body}") if ENV['DEBUG']
|
107
106
|
end
|
108
|
-
|
109
107
|
end
|
110
108
|
end
|
111
109
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-rustore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladislav Onishchenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -181,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
181
|
- !ruby/object:Gem::Version
|
182
182
|
version: '0'
|
183
183
|
requirements: []
|
184
|
-
rubygems_version: 3.
|
184
|
+
rubygems_version: 3.3.3
|
185
185
|
signing_key:
|
186
186
|
specification_version: 4
|
187
187
|
summary: Rustore fastlane integration plugin
|