fastlane-plugin-amazon_appstore 1.3.0 → 1.4.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: 42700d0bc41d91c1a7cebc2f4d5583f703b2532ab72581f6a96e3c2e1a9508e8
|
4
|
+
data.tar.gz: 0b180a4dafa671749b7f3b95cac6c6991e602230d0aab9f0ce979fa281ecdd92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2157e233420340003117f553e20187bff0ab2a66eda203188dd292529e0667f3c77e4ba80a62e3f30e7ba85684ddf787385d2fd92a9d7412f4ba7456d0b9616e
|
7
|
+
data.tar.gz: 2973cac2d292082f30358107c7017ea7e9efda6d477a320f16d4797022503b98c01acbb2b9b9a5f8d28abc7d07834bfffa1f03d333b5e7945571de05a07e8d4d
|
data/README.md
CHANGED
@@ -41,6 +41,7 @@ upload_to_amazon_appstore(
|
|
41
41
|
| metadata_path | Path to the directory containing the metadata files | ./fastlane/metadata/android |
|
42
42
|
| changes_not_sent_for_review | Indicates that the changes in this edit will not be reviewed until they are explicitly sent for review from the Amazon Appstore Console UI | false |
|
43
43
|
| overwrite_upload | Whether to allow overwriting an existing upload | false |
|
44
|
+
| overwrite_upload_mode | Upload strategy when overwrite_upload is true. Can be 'new' (delete existing edit and create new) or 'reuse' (reuse existing edit) | new |
|
44
45
|
| timeout | Timeout for read, open (in seconds) | 300 |
|
45
46
|
* = default value is dependent on the user's system
|
46
47
|
|
@@ -22,30 +22,46 @@ module Fastlane
|
|
22
22
|
UI.abort_with_message!("Failed to get token") if token.nil?
|
23
23
|
|
24
24
|
if params[:overwrite_upload]
|
25
|
-
|
25
|
+
if params[:overwrite_upload_mode] == "new"
|
26
|
+
UI.message("Deleting existing edits if needed (overwrite_upload: true, overwrite_upload_mode: new)...")
|
27
|
+
begin
|
28
|
+
Helper::AmazonAppstoreHelper.delete_edits_if_exists(
|
29
|
+
app_id: params[:package_name],
|
30
|
+
token: token
|
31
|
+
)
|
32
|
+
rescue StandardError => e
|
33
|
+
UI.error(e.message)
|
34
|
+
UI.abort_with_message!("Failed to delete edits (overwrite_upload: true, overwrite_upload_mode: new)")
|
35
|
+
end
|
36
|
+
elsif params[:overwrite_upload_mode] == "reuse"
|
37
|
+
UI.message("Retrieving active edit (overwrite_upload: true, overwrite_upload_mode: reuse)...")
|
38
|
+
begin
|
39
|
+
edit_id, = Helper::AmazonAppstoreHelper.get_edits(
|
40
|
+
app_id: params[:package_name],
|
41
|
+
token: token
|
42
|
+
)
|
43
|
+
rescue StandardError => e
|
44
|
+
UI.error(e.message)
|
45
|
+
UI.abort_with_message!("Failed to get edit_id (overwrite_upload: true, overwrite_upload_mode: reuse)")
|
46
|
+
end
|
47
|
+
UI.message("No active edit") if edit_id.nil?
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
if edit_id.nil?
|
52
|
+
UI.message("Creating new edits...")
|
26
53
|
begin
|
27
|
-
Helper::AmazonAppstoreHelper.
|
54
|
+
edit_id = Helper::AmazonAppstoreHelper.create_edits(
|
28
55
|
app_id: params[:package_name],
|
29
56
|
token: token
|
30
57
|
)
|
31
58
|
rescue StandardError => e
|
32
59
|
UI.error(e.message)
|
33
|
-
UI.abort_with_message!("Failed to
|
60
|
+
UI.abort_with_message!("Failed to create edits")
|
34
61
|
end
|
62
|
+
UI.abort_with_message!("Failed to get edit_id") if edit_id.nil?
|
35
63
|
end
|
36
64
|
|
37
|
-
UI.message("Creating new edits...")
|
38
|
-
begin
|
39
|
-
edit_id = Helper::AmazonAppstoreHelper.create_edits(
|
40
|
-
app_id: params[:package_name],
|
41
|
-
token: token
|
42
|
-
)
|
43
|
-
rescue StandardError => e
|
44
|
-
UI.error(e.message)
|
45
|
-
UI.abort_with_message!("Failed to create edits")
|
46
|
-
end
|
47
|
-
UI.abort_with_message!("Failed to get edit_id") if edit_id.nil?
|
48
|
-
|
49
65
|
apks = []
|
50
66
|
apks << params[:apk] if params[:apk]
|
51
67
|
apks += params[:apk_paths] if params[:apk_paths]
|
@@ -66,7 +82,6 @@ module Fastlane
|
|
66
82
|
UI.error(e.message)
|
67
83
|
UI.abort_with_message!("Failed to replace APKs")
|
68
84
|
end
|
69
|
-
|
70
85
|
# Extract version codes and display results
|
71
86
|
version_codes = apk_results.map { |result| result[:version_code] }
|
72
87
|
apk_results.each_with_index do |result, index|
|
@@ -176,6 +191,13 @@ module Fastlane
|
|
176
191
|
default_value: false,
|
177
192
|
optional: true,
|
178
193
|
type: Boolean),
|
194
|
+
FastlaneCore::ConfigItem.new(key: :overwrite_upload_mode,
|
195
|
+
env_name: "AMAZON_APPSTORE_OVERWRITE_UPLOAD_MODE",
|
196
|
+
description: "Upload strategy. Can be 'new' or 'reuse'",
|
197
|
+
default_value: 'new',
|
198
|
+
verify_block: proc do |value|
|
199
|
+
UI.user_error!("overwrite_upload can only be 'new' or 'reuse'") unless %w(new reuse).include?(value)
|
200
|
+
end),
|
179
201
|
FastlaneCore::ConfigItem.new(key: :timeout,
|
180
202
|
env_name: "AMAZON_APPSTORE_TIMEOUT",
|
181
203
|
description: "Timeout for read, open (in seconds)",
|
@@ -47,6 +47,19 @@ module Fastlane
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def self.delete_edits_if_exists(app_id:, token:)
|
50
|
+
edits_id, etag = self.get_edits(app_id: app_id, token: token)
|
51
|
+
return nil if edits_id.nil? || etag.nil? # Do nothing if edits do not exist
|
52
|
+
|
53
|
+
edits_path = "api/appstore/v1/applications/#{app_id}/edits"
|
54
|
+
delete_edits_response = api_client.delete("#{edits_path}/#{edits_id}") do |request|
|
55
|
+
request.headers['Authorization'] = "Bearer #{token}"
|
56
|
+
request.headers['If-Match'] = etag
|
57
|
+
end
|
58
|
+
|
59
|
+
raise StandardError, delete_edits_response.body unless delete_edits_response.success?
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.get_edits(app_id:, token:)
|
50
63
|
edits_path = "api/appstore/v1/applications/#{app_id}/edits"
|
51
64
|
edits_response = api_client.get(edits_path) do |request|
|
52
65
|
request.headers['Authorization'] = "Bearer #{token}"
|
@@ -55,14 +68,8 @@ module Fastlane
|
|
55
68
|
|
56
69
|
edits_id = edits_response.body[:id]
|
57
70
|
etag = edits_response.headers['Etag']
|
58
|
-
return nil if edits_id.nil? || etag.nil? # Do nothing if edits do not exist
|
59
71
|
|
60
|
-
|
61
|
-
request.headers['Authorization'] = "Bearer #{token}"
|
62
|
-
request.headers['If-Match'] = etag
|
63
|
-
end
|
64
|
-
|
65
|
-
raise StandardError, delete_edits_response.body unless delete_edits_response.success?
|
72
|
+
return edits_id, etag
|
66
73
|
end
|
67
74
|
|
68
75
|
def self.upload_apk(local_apk_path:, app_id:, edit_id:, token:)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-amazon_appstore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ntsk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-08-
|
11
|
+
date: 2025-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|