fastlane-plugin-rustore_publish 0.3.1 → 0.3.3
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 +4 -4
- data/README.md +120 -5
- data/lib/fastlane/plugin/rustore_publish/actions/rustore_check.rb +113 -0
- data/lib/fastlane/plugin/rustore_publish/actions/rustore_upload.rb +42 -36
- data/lib/fastlane/plugin/rustore_publish/helper/rustore_client.rb +25 -1
- data/lib/fastlane/plugin/rustore_publish/helper/rustore_options.rb +53 -0
- data/lib/fastlane/plugin/rustore_publish/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fd132c23b34f14d456105b21b740e4ceca699c8b7fd713291dfe16e78b7652dc
|
|
4
|
+
data.tar.gz: 2ff78c0bec58b88fdf8213cfa335db28d7ab8518170b593c83d9ca59eacf8eaa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 80d19c4feb36cda3a7885779e41052852e6d8fd0404832ebabce322ba436bb94f465061f7008f0128a0200e64f7e615bfc6a97e393249a41b2857ffbdf422953
|
|
7
|
+
data.tar.gz: bf4d2808075c2be01281891769746700e3a314f397b4b3c60d2853aea5f7896a4938fc8d3e2f69b0e073024201aa80b8775d94e28fe7e1253aba801591018e3e
|
data/README.md
CHANGED
|
@@ -1,15 +1,51 @@
|
|
|
1
1
|
# RuStore fastlane plugin — publish Android apps to RuStore from CI
|
|
2
2
|
|
|
3
|
+
[](https://rubygems.org/gems/fastlane-plugin-rustore_publish)
|
|
4
|
+
[](https://rubygems.org/gems/fastlane-plugin-rustore_publish)
|
|
5
|
+
[](https://rubygems.org/gems/fastlane-plugin-rustore_publish)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
3
8
|

|
|
4
9
|
|
|
5
10
|
Fastlane plugin for publishing Android applications to [RuStore](https://rustore.ru) — the Russian app store — via the [RuStore Public API](https://www.rustore.ru/help/work-with-rustore-api/api-upload-publication-app). Uses the new `public-api-m.rustore.ru` domain with the Russian Trusted Root CA bundled, so nothing has to be installed on the runner.
|
|
6
11
|
|
|
7
|
-
Gem: `fastlane-plugin-rustore_publish` ·
|
|
12
|
+
Gem: `fastlane-plugin-rustore_publish` · Actions: `rustore_upload`, `rustore_check`
|
|
13
|
+
|
|
14
|
+
## Quick start
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
fastlane add_plugin rustore_publish
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```ruby
|
|
21
|
+
# fastlane/Fastfile
|
|
22
|
+
lane :deploy_rustore do
|
|
23
|
+
rustore_upload(
|
|
24
|
+
package_name: "com.example.app",
|
|
25
|
+
key_id: ENV["RUSTORE_KEY_ID"],
|
|
26
|
+
private_key: ENV["RUSTORE_PRIVATE_KEY"],
|
|
27
|
+
aab_path: "app/build/outputs/bundle/release/app-release.aab",
|
|
28
|
+
whats_new: "Bug fixes and improvements"
|
|
29
|
+
)
|
|
30
|
+
end
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The key comes from RuStore Console → Company → API RuStore, see [Setup](#setup-rustore-api-credentials).
|
|
34
|
+
|
|
35
|
+
## По-русски
|
|
36
|
+
|
|
37
|
+
Плагин fastlane для публикации Android-приложений в RuStore из CI: создаёт черновик, загружает AAB и HMS APK, отправляет на модерацию. Работает через новый домен `public-api-m.rustore.ru`, на который RuStore переводит Public API; корневой сертификат Минцифры уже внутри плагина, ставить его на раннер не нужно. В логах CI видно, сколько шла отправка файла и сколько RuStore его проверял, а ошибки (таймаут, TLS, 504, новые чувствительные разрешения) приходят с подсказкой, что делать.
|
|
38
|
+
|
|
39
|
+
Чтобы на модерацию отправлял человек, а не CI, есть `submit_for_review: false` (или `RUSTORE_SUBMIT_FOR_REVIEW=false`): плагин создаёт черновик, загружает сборки, задаёт процент раскатки и тип публикации и останавливается до модерации — отправить черновик можно кнопкой в RuStore Console.
|
|
40
|
+
|
|
41
|
+
Для пробного прогона без выкладки есть `rustore_check`: получает токен и показывает последние версии приложения, ничего не загружая; 404 на списке версий считается успехом (ключ рабочий, версий через API пока нет).
|
|
42
|
+
|
|
43
|
+
Установка — `fastlane add_plugin rustore_publish`, пример — в [Quick start](#quick-start) выше. Вопросы и баги — в [Issues](https://github.com/gorban-dev/rustore-fastlane-plugin/issues), можно на русском.
|
|
8
44
|
|
|
9
45
|
## Features
|
|
10
46
|
|
|
11
47
|
- Upload **AAB** (Google/GMS, main artifact) and **APK** (Huawei/HMS, secondary) in a single version
|
|
12
|
-
- Full publish workflow: authenticate → create draft (with publication settings) → upload files → submit for moderation
|
|
48
|
+
- Full publish workflow: authenticate → create draft (with publication settings) → upload files → submit for moderation (or leave the draft for RuStore Console with `submit_for_review: false`)
|
|
13
49
|
- The pipeline always finishes immediately after submission — no waiting for moderation
|
|
14
50
|
- **GitLab CI** collapsible log sections (foldable blocks in Pipeline UI)
|
|
15
51
|
- Staged rollout support (`rollout_percentage`)
|
|
@@ -77,8 +113,9 @@ You will get two values:
|
|
|
77
113
|
| `moder_info` | `RUSTORE_MODER_INFO` | no | — | Notes for the RuStore moderator, e.g. test credentials (max 180 chars) |
|
|
78
114
|
| `publish_type` | `RUSTORE_PUBLISH_TYPE` | no | `INSTANTLY` | `INSTANTLY` / `MANUAL` / `DELAYED` |
|
|
79
115
|
| `release_date` | `RUSTORE_RELEASE_DATE` | no | — | ISO 8601 datetime, only for `DELAYED` |
|
|
80
|
-
| `rollout_percentage` | `RUSTORE_ROLLOUT_PERCENTAGE` | no | — | Staged rollout: allowed values `5, 10, 25, 50, 75, 100` |
|
|
116
|
+
| `rollout_percentage` | `RUSTORE_ROLLOUT_PERCENTAGE` | no | — | Staged rollout: allowed values `5, 10, 25, 50, 75, 100`; only with `INSTANTLY` or `MANUAL` |
|
|
81
117
|
| `update_priority` | `RUSTORE_UPDATE_PRIORITY` | no | `0` | In-app update priority sent with the moderation request, `0`–`5` |
|
|
118
|
+
| `submit_for_review` | `RUSTORE_SUBMIT_FOR_REVIEW` | no | `true` | `false` — stop before moderation and leave the draft to be submitted from RuStore Console; `update_priority` is then not sent |
|
|
82
119
|
| `upload_timeout` | `RUSTORE_UPLOAD_TIMEOUT` | no | `900` | Seconds to wait for RuStore to answer an AAB/APK upload. RuStore checks the file (permissions, SDKs) before answering |
|
|
83
120
|
|
|
84
121
|
### Draft metadata (NEW — RuStore API v2)
|
|
@@ -139,10 +176,10 @@ rustore_upload(
|
|
|
139
176
|
| `publish_type` | Behaviour |
|
|
140
177
|
|---|---|
|
|
141
178
|
| `INSTANTLY` | RuStore auto-publishes after moderation passes (default) |
|
|
142
|
-
| `DELAYED` | Scheduled publication via `release_date` in ISO 8601 |
|
|
179
|
+
| `DELAYED` | Scheduled publication via `release_date` in ISO 8601; no `rollout_percentage` |
|
|
143
180
|
| `MANUAL` | Moderation runs normally; publish manually from RuStore Console |
|
|
144
181
|
|
|
145
|
-
The pipeline finishes immediately after submitting for moderation for all three types.
|
|
182
|
+
The pipeline finishes immediately after submitting for moderation for all three types. With `submit_for_review: false` it does not submit at all: see [Upload without submitting](#upload-without-submitting-for-moderation).
|
|
146
183
|
|
|
147
184
|
---
|
|
148
185
|
|
|
@@ -198,6 +235,29 @@ lane :deploy_rustore_scheduled do
|
|
|
198
235
|
end
|
|
199
236
|
```
|
|
200
237
|
|
|
238
|
+
### Upload without submitting for moderation
|
|
239
|
+
|
|
240
|
+
CI creates the draft, uploads the builds and sets rollout and publish type; a person sends it for moderation from RuStore Console.
|
|
241
|
+
|
|
242
|
+
```ruby
|
|
243
|
+
lane :upload_rustore_draft do
|
|
244
|
+
rustore_upload(
|
|
245
|
+
package_name: "com.example.app",
|
|
246
|
+
key_id: ENV["RUSTORE_KEY_ID"],
|
|
247
|
+
private_key: ENV["RUSTORE_PRIVATE_KEY"],
|
|
248
|
+
aab_path: "app/build/outputs/bundle/gmsRelease/app-gms-release.aab",
|
|
249
|
+
hms_apk_path: "app/build/outputs/apk/hmsRelease/app-hms-release.apk",
|
|
250
|
+
publish_type: "MANUAL",
|
|
251
|
+
rollout_percentage: 10,
|
|
252
|
+
submit_for_review: false # step 5 is skipped, no commit request
|
|
253
|
+
)
|
|
254
|
+
end
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
- `update_priority` is sent only with the moderation request, so here it is ignored with a warning: set the priority in the Console when submitting.
|
|
258
|
+
- The next run deletes this draft if it is still not submitted (step 2), as it does with any unsubmitted draft: the new build replaces the old one.
|
|
259
|
+
- `publish_type: MANUAL` alone is a different thing: the build still goes to moderation, only the publication after it is manual.
|
|
260
|
+
|
|
201
261
|
### Combined with Gradle build
|
|
202
262
|
|
|
203
263
|
```ruby
|
|
@@ -218,6 +278,39 @@ end
|
|
|
218
278
|
|
|
219
279
|
---
|
|
220
280
|
|
|
281
|
+
## Check access (`rustore_check`)
|
|
282
|
+
|
|
283
|
+
A dry run for CI: gets a token, reads the first page of the app's versions and logs up to 5 latest of them. Creates, deletes and uploads nothing, and does not touch drafts. Use it to verify that the key in CI works and covers the package before a real release.
|
|
284
|
+
|
|
285
|
+
```ruby
|
|
286
|
+
lane :check_rustore do
|
|
287
|
+
rustore_check(
|
|
288
|
+
package_name: "com.example.app",
|
|
289
|
+
key_id: ENV["RUSTORE_KEY_ID"],
|
|
290
|
+
private_key: ENV["RUSTORE_PRIVATE_KEY"] # or private_key_path:
|
|
291
|
+
)
|
|
292
|
+
end
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
```
|
|
296
|
+
[RuStore] ✓ JWE token obtained
|
|
297
|
+
[RuStore] versionId=1234 versionName=2.4.0 versionCode=240 versionStatus=ACTIVE
|
|
298
|
+
[RuStore] versionId=1201 versionName=2.3.1 versionCode=231 versionStatus=PREVIOUS_ACTIVE
|
|
299
|
+
[RuStore] ✓ RuStore OK — ключ рабочий, версий: 2
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
| Result | Behaviour |
|
|
303
|
+
|---|---|
|
|
304
|
+
| Versions found | Logs up to 5 latest, returns the Array of version Hashes |
|
|
305
|
+
| Empty list | Success, returns `[]` |
|
|
306
|
+
| HTTP 404 on the version list | Success: the key is valid and covers the package, but RuStore opens the versions API only after the first publication from RuStore Console. Returns `[]` |
|
|
307
|
+
| `private_key` and `private_key_path` both missing or blank | Fails before any request: `RuStore: private_key или private_key_path не задан` |
|
|
308
|
+
| Auth error, 401/403, 5xx, network | Fails with a hint, like `rustore_upload` |
|
|
309
|
+
|
|
310
|
+
The 404 case is detected by HTTP status, not by message text.
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
221
314
|
## CI/CD integration
|
|
222
315
|
|
|
223
316
|
### GitLab CI
|
|
@@ -268,6 +361,28 @@ lane :deploy_rustore do
|
|
|
268
361
|
end
|
|
269
362
|
```
|
|
270
363
|
|
|
364
|
+
**Checking the key without a release.** A manual job that runs `rustore_check`, e.g. after rotating the key:
|
|
365
|
+
|
|
366
|
+
```yaml
|
|
367
|
+
check_rustore:
|
|
368
|
+
stage: deploy
|
|
369
|
+
script:
|
|
370
|
+
- bundle exec fastlane check_rustore
|
|
371
|
+
rules:
|
|
372
|
+
- when: manual
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
```ruby
|
|
376
|
+
# fastlane/Fastfile
|
|
377
|
+
lane :check_rustore do
|
|
378
|
+
rustore_check(
|
|
379
|
+
package_name: "com.example.app",
|
|
380
|
+
key_id: ENV["RUSTORE_KEY_ID"],
|
|
381
|
+
private_key_path: ENV["RUSTORE_PRIVATE_KEY"]
|
|
382
|
+
)
|
|
383
|
+
end
|
|
384
|
+
```
|
|
385
|
+
|
|
271
386
|
**Storing the private key in GitLab:**
|
|
272
387
|
|
|
273
388
|
- Go to **Settings → CI/CD → Variables**
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
require "fastlane/action"
|
|
2
|
+
require_relative "../helper/rustore_auth"
|
|
3
|
+
require_relative "../helper/rustore_client"
|
|
4
|
+
require_relative "../helper/rustore_logger"
|
|
5
|
+
require_relative "../helper/rustore_options"
|
|
6
|
+
|
|
7
|
+
module Fastlane
|
|
8
|
+
module Actions
|
|
9
|
+
# Dry run for CI: checks that the RuStore API key works and covers the
|
|
10
|
+
# package. Reads the version list only; never creates, deletes or uploads.
|
|
11
|
+
class RustoreCheckAction < Action
|
|
12
|
+
TOTAL_STEPS = 2
|
|
13
|
+
SHOWN_VERSION_COUNT = 5
|
|
14
|
+
|
|
15
|
+
def self.run(params)
|
|
16
|
+
private_key = RustorePublish::RustoreOptions.private_key!(params)
|
|
17
|
+
package_name = params[:package_name]
|
|
18
|
+
logger = RustorePublish::RustoreLogger.new(total_steps: TOTAL_STEPS)
|
|
19
|
+
|
|
20
|
+
# ── Step 1: Authentication ─────────────────────────────────────────────
|
|
21
|
+
logger.step(1, "Authentication")
|
|
22
|
+
auth = RustorePublish::RustoreAuth.new(
|
|
23
|
+
key_id: params[:key_id],
|
|
24
|
+
private_key: private_key,
|
|
25
|
+
logger: logger
|
|
26
|
+
)
|
|
27
|
+
auth.refresh!
|
|
28
|
+
logger.success("JWE token obtained")
|
|
29
|
+
|
|
30
|
+
# ── Step 2: Versions ───────────────────────────────────────────────────
|
|
31
|
+
logger.step(2, "Versions")
|
|
32
|
+
client = RustorePublish::RustoreClient.new(auth: auth, logger: logger)
|
|
33
|
+
|
|
34
|
+
begin
|
|
35
|
+
versions = client.list_versions(package_name: package_name)
|
|
36
|
+
rescue RustorePublish::RustoreClient::NotFoundError
|
|
37
|
+
logger.success(
|
|
38
|
+
"RuStore OK — авторизация прошла, ключ покрывает #{package_name}; активных версий нет, " \
|
|
39
|
+
"API версий откроется после первой публикации в консоли"
|
|
40
|
+
)
|
|
41
|
+
logger.finalize
|
|
42
|
+
return []
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
if versions.empty?
|
|
46
|
+
logger.success("RuStore OK — авторизация прошла, версий у #{package_name} нет")
|
|
47
|
+
else
|
|
48
|
+
latest = versions.sort_by { |v| -v["versionId"].to_i }.first(SHOWN_VERSION_COUNT)
|
|
49
|
+
latest.each { |v| logger.info(format_version(v)) }
|
|
50
|
+
logger.success("RuStore OK — ключ рабочий, версий: #{versions.size}")
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
logger.finalize
|
|
54
|
+
versions
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def self.format_version(version)
|
|
58
|
+
%w[versionId versionName versionCode versionStatus]
|
|
59
|
+
.map { |field| "#{field}=#{version[field]}" }
|
|
60
|
+
.join(" ")
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# ── Parameter definitions ────────────────────────────────────────────────
|
|
64
|
+
|
|
65
|
+
def self.available_options
|
|
66
|
+
RustorePublish::RustoreOptions.credentials
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def self.description
|
|
70
|
+
"Check that the RuStore API key works for a package, without uploading anything"
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def self.details
|
|
74
|
+
<<~DETAILS
|
|
75
|
+
Gets a token and reads the first page of the app's versions from the
|
|
76
|
+
RuStore Public API, then logs up to 5 latest of them.
|
|
77
|
+
|
|
78
|
+
HTTP 404 on the version list counts as success: the key is valid and
|
|
79
|
+
covers the package, but RuStore opens the versions API only after the
|
|
80
|
+
first publication from RuStore Console.
|
|
81
|
+
|
|
82
|
+
Does not create, delete or upload anything and does not touch drafts.
|
|
83
|
+
DETAILS
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def self.return_value
|
|
87
|
+
"Array of version hashes as returned by RuStore ([] when the app has no versions)"
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def self.authors
|
|
91
|
+
["Sergey Gorban"]
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def self.example_code
|
|
95
|
+
[
|
|
96
|
+
'rustore_check(
|
|
97
|
+
package_name: "com.example.app",
|
|
98
|
+
key_id: ENV["RUSTORE_KEY_ID"],
|
|
99
|
+
private_key: ENV["RUSTORE_PRIVATE_KEY"]
|
|
100
|
+
)'
|
|
101
|
+
]
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def self.category
|
|
105
|
+
:production
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def self.is_supported?(platform)
|
|
109
|
+
platform == :android
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|
|
@@ -2,6 +2,7 @@ require "fastlane/action"
|
|
|
2
2
|
require_relative "../helper/rustore_auth"
|
|
3
3
|
require_relative "../helper/rustore_client"
|
|
4
4
|
require_relative "../helper/rustore_logger"
|
|
5
|
+
require_relative "../helper/rustore_options"
|
|
5
6
|
|
|
6
7
|
module Fastlane
|
|
7
8
|
module Actions
|
|
@@ -11,6 +12,12 @@ module Fastlane
|
|
|
11
12
|
def self.run(params)
|
|
12
13
|
logger = RustorePublish::RustoreLogger.new(total_steps: TOTAL_STEPS)
|
|
13
14
|
|
|
15
|
+
# RuStore allows partial publication only with INSTANTLY or MANUAL;
|
|
16
|
+
# with DELAYED the draft request fails, so stop before any request.
|
|
17
|
+
if params[:rollout_percentage] && params[:publish_type] == "DELAYED"
|
|
18
|
+
UI.user_error!("rollout_percentage is not allowed with publish_type DELAYED: RuStore supports partial publication only with INSTANTLY or MANUAL. Remove rollout_percentage or change publish_type")
|
|
19
|
+
end
|
|
20
|
+
|
|
14
21
|
# ── Step 1: Authentication ─────────────────────────────────────────────
|
|
15
22
|
logger.step(1, "Authentication")
|
|
16
23
|
|
|
@@ -42,6 +49,7 @@ module Fastlane
|
|
|
42
49
|
publish_type = params[:publish_type]
|
|
43
50
|
release_date = params[:release_date]
|
|
44
51
|
rollout_percentage = params[:rollout_percentage]
|
|
52
|
+
submit_for_review = params[:submit_for_review]
|
|
45
53
|
|
|
46
54
|
if release_date && publish_type != "DELAYED"
|
|
47
55
|
logger.warning("release_date is set but publish_type is '#{publish_type}' — only used with DELAYED")
|
|
@@ -78,6 +86,7 @@ module Fastlane
|
|
|
78
86
|
["Rollout", rollout_percentage ? "#{rollout_percentage}%" : "100%"],
|
|
79
87
|
["Release date", release_date || "(not set)"],
|
|
80
88
|
["Update priority", params[:update_priority]],
|
|
89
|
+
["Submit for review", submit_for_review ? "yes" : "no"],
|
|
81
90
|
["Upload timeout", "#{params[:upload_timeout]}s"]
|
|
82
91
|
])
|
|
83
92
|
|
|
@@ -155,6 +164,17 @@ module Fastlane
|
|
|
155
164
|
|
|
156
165
|
# ── Step 5: Submit for moderation ─────────────────────────────────────
|
|
157
166
|
logger.step(5, "Submitting for moderation")
|
|
167
|
+
|
|
168
|
+
unless submit_for_review
|
|
169
|
+
logger.info("Skipped — submit the draft for moderation from RuStore Console")
|
|
170
|
+
if params[:update_priority] != 0
|
|
171
|
+
logger.warning("update_priority=#{params[:update_priority]} is not sent: it goes only with the moderation request — set it in RuStore Console when submitting")
|
|
172
|
+
end
|
|
173
|
+
logger.finalize
|
|
174
|
+
UI.success("#{RustorePublish::RustoreLogger::PREFIX} All done! #{package_name} versionId=#{version_id} uploaded as a draft, not submitted for moderation.")
|
|
175
|
+
return
|
|
176
|
+
end
|
|
177
|
+
|
|
158
178
|
client.submit_for_review(package_name: package_name, version_id: version_id, update_priority: params[:update_priority])
|
|
159
179
|
|
|
160
180
|
case publish_type
|
|
@@ -173,41 +193,7 @@ module Fastlane
|
|
|
173
193
|
# ── Parameter definitions ────────────────────────────────────────────────
|
|
174
194
|
|
|
175
195
|
def self.available_options
|
|
176
|
-
[
|
|
177
|
-
# ── Authentication ─────────────────────────────────────────────────
|
|
178
|
-
FastlaneCore::ConfigItem.new(
|
|
179
|
-
key: :key_id,
|
|
180
|
-
env_name: "RUSTORE_KEY_ID",
|
|
181
|
-
description: "API key ID from RuStore Console → Company → API RuStore",
|
|
182
|
-
type: String,
|
|
183
|
-
optional: false
|
|
184
|
-
),
|
|
185
|
-
FastlaneCore::ConfigItem.new(
|
|
186
|
-
key: :private_key_path,
|
|
187
|
-
env_name: "RUSTORE_PRIVATE_KEY_PATH",
|
|
188
|
-
description: "Path to RSA private key PEM file (mutually exclusive with private_key)",
|
|
189
|
-
type: String,
|
|
190
|
-
optional: true,
|
|
191
|
-
verify_block: proc { |v| UI.user_error!("private_key_path file not found: #{v}") unless File.exist?(v) }
|
|
192
|
-
),
|
|
193
|
-
FastlaneCore::ConfigItem.new(
|
|
194
|
-
key: :private_key,
|
|
195
|
-
env_name: "RUSTORE_PRIVATE_KEY",
|
|
196
|
-
description: "RSA private key PEM content (mutually exclusive with private_key_path)",
|
|
197
|
-
type: String,
|
|
198
|
-
optional: true,
|
|
199
|
-
sensitive: true
|
|
200
|
-
),
|
|
201
|
-
|
|
202
|
-
# ── App identity ───────────────────────────────────────────────────
|
|
203
|
-
FastlaneCore::ConfigItem.new(
|
|
204
|
-
key: :package_name,
|
|
205
|
-
env_name: "RUSTORE_PACKAGE_NAME",
|
|
206
|
-
description: "Application package name (e.g. com.example.app)",
|
|
207
|
-
type: String,
|
|
208
|
-
optional: false
|
|
209
|
-
),
|
|
210
|
-
|
|
196
|
+
RustorePublish::RustoreOptions.credentials + [
|
|
211
197
|
# ── Build files ────────────────────────────────────────────────────
|
|
212
198
|
FastlaneCore::ConfigItem.new(
|
|
213
199
|
key: :aab_path,
|
|
@@ -272,7 +258,7 @@ module Fastlane
|
|
|
272
258
|
FastlaneCore::ConfigItem.new(
|
|
273
259
|
key: :rollout_percentage,
|
|
274
260
|
env_name: "RUSTORE_ROLLOUT_PERCENTAGE",
|
|
275
|
-
description: "Staged rollout: allowed values are 5, 10, 25, 50, 75, 100; omit for full rollout",
|
|
261
|
+
description: "Staged rollout: allowed values are 5, 10, 25, 50, 75, 100; omit for full rollout; not with DELAYED",
|
|
276
262
|
type: Integer,
|
|
277
263
|
optional: true,
|
|
278
264
|
verify_block: proc { |v|
|
|
@@ -288,6 +274,14 @@ module Fastlane
|
|
|
288
274
|
optional: true,
|
|
289
275
|
verify_block: proc { |v| UI.user_error!("update_priority must be between 0 and 5") unless (0..5).cover?(v) }
|
|
290
276
|
),
|
|
277
|
+
FastlaneCore::ConfigItem.new(
|
|
278
|
+
key: :submit_for_review,
|
|
279
|
+
env_name: "RUSTORE_SUBMIT_FOR_REVIEW",
|
|
280
|
+
description: "Send the draft for moderation (commit); false leaves it as a draft to submit from RuStore Console",
|
|
281
|
+
default_value: true,
|
|
282
|
+
type: Fastlane::Boolean,
|
|
283
|
+
optional: true
|
|
284
|
+
),
|
|
291
285
|
|
|
292
286
|
# ── Network ────────────────────────────────────────────────────────
|
|
293
287
|
FastlaneCore::ConfigItem.new(
|
|
@@ -440,6 +434,8 @@ module Fastlane
|
|
|
440
434
|
- APK (Huawei/HMS build) as a secondary artifact (servicesType=HMS)
|
|
441
435
|
|
|
442
436
|
The pipeline always finishes immediately after submitting for moderation.
|
|
437
|
+
With submit_for_review: false it stops before moderation and leaves the
|
|
438
|
+
draft (files, rollout, publish type) to be submitted from RuStore Console.
|
|
443
439
|
Publication behaviour is controlled by publish_type:
|
|
444
440
|
INSTANTLY — RuStore auto-publishes after moderation passes (default)
|
|
445
441
|
DELAYED — scheduled publication via release_date
|
|
@@ -485,6 +481,16 @@ module Fastlane
|
|
|
485
481
|
' aab_path: "...",',
|
|
486
482
|
' publish_type: "DELAYED",',
|
|
487
483
|
' release_date: "2025-03-01T10:00:00+03:00"',
|
|
484
|
+
')',
|
|
485
|
+
'',
|
|
486
|
+
'# Upload without submitting — a person sends the draft for moderation from RuStore Console',
|
|
487
|
+
'rustore_upload(',
|
|
488
|
+
' package_name: "com.example.app",',
|
|
489
|
+
' key_id: ENV["RUSTORE_KEY_ID"],',
|
|
490
|
+
' private_key: ENV["RUSTORE_PRIVATE_KEY"],',
|
|
491
|
+
' aab_path: "...",',
|
|
492
|
+
' rollout_percentage: 10,',
|
|
493
|
+
' submit_for_review: false',
|
|
488
494
|
')'
|
|
489
495
|
].join("\n")
|
|
490
496
|
end
|
|
@@ -25,6 +25,17 @@ module Fastlane
|
|
|
25
25
|
SERVICES_TYPE_UNKNOWN = "Unknown"
|
|
26
26
|
SERVICES_TYPE_HMS = "HMS"
|
|
27
27
|
|
|
28
|
+
# Raised by #list_versions when RuStore answers 404. The caller decides
|
|
29
|
+
# whether that is a failure; the check is by HTTP status, not by text.
|
|
30
|
+
class NotFoundError < StandardError
|
|
31
|
+
attr_reader :path
|
|
32
|
+
|
|
33
|
+
def initialize(path)
|
|
34
|
+
@path = path
|
|
35
|
+
super("RuStore returned 404 for #{path}")
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
28
39
|
def initialize(auth:, logger: nil, upload_timeout: DEFAULT_UPLOAD_TIMEOUT, wait_log_interval: WAIT_LOG_INTERVAL)
|
|
29
40
|
@auth = auth
|
|
30
41
|
@logger = logger || RustoreLogger.new
|
|
@@ -67,6 +78,17 @@ module Fastlane
|
|
|
67
78
|
versions.find { |v| v["versionStatus"] == "DRAFT" }
|
|
68
79
|
end
|
|
69
80
|
|
|
81
|
+
# GET /application/{package}/version?page=0&size={page_size}
|
|
82
|
+
# Reads the first page of the app's versions.
|
|
83
|
+
#
|
|
84
|
+
# @return [Array<Hash>] versions as RuStore returns them, [] if there are none
|
|
85
|
+
# @raise [NotFoundError] on HTTP 404
|
|
86
|
+
def list_versions(package_name:, page_size: 20)
|
|
87
|
+
resp = get("application/#{package_name}/version?page=0&size=#{page_size}", raise_not_found: true)
|
|
88
|
+
versions = resp.dig("body", "content")
|
|
89
|
+
versions.is_a?(Array) ? versions : []
|
|
90
|
+
end
|
|
91
|
+
|
|
70
92
|
# DELETE /application/{package}/version/{versionId}
|
|
71
93
|
def delete_draft(package_name:, version_id:)
|
|
72
94
|
delete("application/#{package_name}/version/#{version_id}")
|
|
@@ -122,10 +144,12 @@ module Fastlane
|
|
|
122
144
|
|
|
123
145
|
# ── HTTP Helpers ─────────────────────────────────────────────────────────
|
|
124
146
|
|
|
125
|
-
def get(path)
|
|
147
|
+
def get(path, raise_not_found: false)
|
|
126
148
|
resp = with_network_errors(path) do
|
|
127
149
|
@conn.get(path) { |r| r.headers["Public-Token"] = @auth.token }
|
|
128
150
|
end
|
|
151
|
+
raise NotFoundError, path if raise_not_found && resp.status == 404
|
|
152
|
+
|
|
129
153
|
handle_response(resp, path)
|
|
130
154
|
end
|
|
131
155
|
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
require "fastlane_core"
|
|
2
|
+
|
|
3
|
+
module Fastlane
|
|
4
|
+
module RustorePublish
|
|
5
|
+
# Options shared by all RuStore actions: API key and package name.
|
|
6
|
+
module RustoreOptions
|
|
7
|
+
def self.credentials
|
|
8
|
+
[
|
|
9
|
+
FastlaneCore::ConfigItem.new(
|
|
10
|
+
key: :key_id,
|
|
11
|
+
env_name: "RUSTORE_KEY_ID",
|
|
12
|
+
description: "API key ID from RuStore Console → Company → API RuStore",
|
|
13
|
+
type: String,
|
|
14
|
+
optional: false
|
|
15
|
+
),
|
|
16
|
+
FastlaneCore::ConfigItem.new(
|
|
17
|
+
key: :private_key_path,
|
|
18
|
+
env_name: "RUSTORE_PRIVATE_KEY_PATH",
|
|
19
|
+
description: "Path to RSA private key PEM file (mutually exclusive with private_key)",
|
|
20
|
+
type: String,
|
|
21
|
+
optional: true,
|
|
22
|
+
verify_block: proc { |v| UI.user_error!("private_key_path file not found: #{v}") unless File.exist?(v) }
|
|
23
|
+
),
|
|
24
|
+
FastlaneCore::ConfigItem.new(
|
|
25
|
+
key: :private_key,
|
|
26
|
+
env_name: "RUSTORE_PRIVATE_KEY",
|
|
27
|
+
description: "RSA private key PEM content (mutually exclusive with private_key_path)",
|
|
28
|
+
type: String,
|
|
29
|
+
optional: true,
|
|
30
|
+
sensitive: true
|
|
31
|
+
),
|
|
32
|
+
FastlaneCore::ConfigItem.new(
|
|
33
|
+
key: :package_name,
|
|
34
|
+
env_name: "RUSTORE_PACKAGE_NAME",
|
|
35
|
+
description: "Application package name (e.g. com.example.app)",
|
|
36
|
+
type: String,
|
|
37
|
+
optional: false
|
|
38
|
+
)
|
|
39
|
+
]
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Returns the PEM from private_key or private_key_path. Fails before any
|
|
43
|
+
# request when neither is set or the key is blank, so an empty CI
|
|
44
|
+
# variable does not end up as an OpenSSL error.
|
|
45
|
+
def self.private_key!(params)
|
|
46
|
+
key = params[:private_key].to_s
|
|
47
|
+
key = File.read(params[:private_key_path]) if key.strip.empty? && params[:private_key_path]
|
|
48
|
+
UI.user_error!("RuStore: private_key или private_key_path не задан") if key.to_s.strip.empty?
|
|
49
|
+
key
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fastlane-plugin-rustore_publish
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sergey Gorban
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-12-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: fastlane
|
|
@@ -108,12 +108,14 @@ files:
|
|
|
108
108
|
- LICENSE
|
|
109
109
|
- README.md
|
|
110
110
|
- lib/fastlane/plugin/rustore_publish.rb
|
|
111
|
+
- lib/fastlane/plugin/rustore_publish/actions/rustore_check.rb
|
|
111
112
|
- lib/fastlane/plugin/rustore_publish/actions/rustore_upload.rb
|
|
112
113
|
- lib/fastlane/plugin/rustore_publish/certs/russian_trusted_root_ca.crt
|
|
113
114
|
- lib/fastlane/plugin/rustore_publish/helper/rustore_auth.rb
|
|
114
115
|
- lib/fastlane/plugin/rustore_publish/helper/rustore_client.rb
|
|
115
116
|
- lib/fastlane/plugin/rustore_publish/helper/rustore_endpoint.rb
|
|
116
117
|
- lib/fastlane/plugin/rustore_publish/helper/rustore_logger.rb
|
|
118
|
+
- lib/fastlane/plugin/rustore_publish/helper/rustore_options.rb
|
|
117
119
|
- lib/fastlane/plugin/rustore_publish/version.rb
|
|
118
120
|
homepage: https://github.com/gorban-dev/rustore-fastlane-plugin
|
|
119
121
|
licenses:
|