fastlane-plugin-amazon_appstore 0.1.0 → 1.1.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: 8c7b408a3aaa0439606dad64da05a2e1e9304b2fbdff0f562e43ec9dc84f5dcf
4
- data.tar.gz: 7a2be8428a7bdf1c48f74736d9d130e8dad6259e75c2b94ccd25704605072641
3
+ metadata.gz: eda405ecfd4552721a5fad15738d20f2923b56007d2bf902f0777675bf407e66
4
+ data.tar.gz: e14898796f4aa0effa8e460adeaebb85bb3a2987db1695110ab505d9cd7ad60a
5
5
  SHA512:
6
- metadata.gz: 5e1e17cec1f9042d853079cb6643460f58d62997b9102a6bd7f6923d2ed23628eaa1d35669803362b09eb27074bcd6aad513f64528540e91edbb1af841cd12f3
7
- data.tar.gz: 7f2962dbfbb14d818cf5fefa4a1b427fe9e06c0ea909afcac74404b5a50eb74420e3fd2e8326d906ea0a0fb2a40bc1254dc3acd142312882969c023b0121ff02
6
+ metadata.gz: fe5a72a6bd0931931f8c7d3a0e2e25a80d487d7a370489fbf8f370c358882c4a225d48c38bdb8130c4bb62b2ebdbf4c299bb08b6b7b90c3086a1e132ee1a7c63
7
+ data.tar.gz: f3768bf3ffe9364a0f922b7756452c547b365ab8a2e5d57a78980ecc628cf4afb5cf6ec3cf620a25b0d09db34277a4d13996c624282d092d7a3539afdd08d4bc
data/README.md CHANGED
@@ -40,7 +40,8 @@ upload_to_amazon_appstore(
40
40
  | client_secret | The client secret you saved | |
41
41
  | skip_upload_changelogs | Whether to skip uploading changelogs | false |
42
42
  | metadata_path | Path to the directory containing the metadata files | ./fastlane/metadata/android |
43
- | changes_not_sent_for_reivew | 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
+ | 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 |
44
+ | overwrite_upload | Whether to allow overwriting an existing upload | false |
44
45
  | timeout | Timeout for read, open (in seconds) | 300 |
45
46
  * = default value is dependent on the user's system
46
47
 
@@ -4,7 +4,7 @@ require_relative '../helper/amazon_appstore_helper'
4
4
  module Fastlane
5
5
  module Actions
6
6
  class UploadToAmazonAppstoreAction < Action
7
- def self.run(params)
7
+ def self.run(params) # rubocop:disable Metrics/PerceivedComplexity
8
8
  Helper::AmazonAppstoreHelper.setup(
9
9
  timeout: params[:timeout]
10
10
  )
@@ -21,6 +21,19 @@ module Fastlane
21
21
  end
22
22
  UI.abort_with_message!("Failed to get token") if token.nil?
23
23
 
24
+ if params[:overwrite_upload]
25
+ UI.message("Deleting existing edits if needed (overwrite_upload: true)...")
26
+ begin
27
+ Helper::AmazonAppstoreHelper.delete_edits_if_exists(
28
+ app_id: params[:package_name],
29
+ token: token
30
+ )
31
+ rescue StandardError => e
32
+ UI.error(e.message)
33
+ UI.abort_with_message!("Failed to delete edits (overwrite_upload: true)")
34
+ end
35
+ end
36
+
24
37
  UI.message("Creating new edits...")
25
38
  begin
26
39
  edit_id = Helper::AmazonAppstoreHelper.create_edits(
@@ -139,6 +152,12 @@ module Fastlane
139
152
  default_value: false,
140
153
  optional: true,
141
154
  type: Boolean),
155
+ FastlaneCore::ConfigItem.new(key: :overwrite_upload,
156
+ env_name: "AMAZON_APPSTORE_OVERWRITE_UPLOAD",
157
+ description: "Whether to allow overwriting an existing upload",
158
+ default_value: false,
159
+ optional: true,
160
+ type: Boolean),
142
161
  FastlaneCore::ConfigItem.new(key: :timeout,
143
162
  env_name: "AMAZON_APPSTORE_TIMEOUT",
144
163
  description: "Timeout for read, open (in seconds)",
@@ -46,6 +46,25 @@ module Fastlane
46
46
  create_edits_response.body[:id]
47
47
  end
48
48
 
49
+ def self.delete_edits_if_exists(app_id:, token:)
50
+ edits_path = "api/appstore/v1/applications/#{app_id}/edits"
51
+ edits_response = api_client.get(edits_path) do |request|
52
+ request.headers['Authorization'] = "Bearer #{token}"
53
+ end
54
+ raise StandardError, edits_response.body unless edits_response.success?
55
+
56
+ edits_id = edits_response.body[:id]
57
+ etag = edits_response.headers['Etag']
58
+ return nil if edits_id.nil? || etag.nil? # Do nothing if edits do not exist
59
+
60
+ delete_edits_response = api_client.delete("#{edits_path}/#{edits_id}") do |request|
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?
66
+ end
67
+
49
68
  def self.replace_apk(local_apk_path:, app_id:, edit_id:, token:)
50
69
  get_apks_path = "api/appstore/v1/applications/#{app_id}/edits/#{edit_id}/apks"
51
70
  get_apks_response = api_client.get(get_apks_path) do |request|
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module AmazonAppstore
3
- VERSION = "0.1.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
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: 0.1.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ntsk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-25 00:00:00.000000000 Z
11
+ date: 2025-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -210,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
210
210
  - !ruby/object:Gem::Version
211
211
  version: '0'
212
212
  requirements: []
213
- rubygems_version: 3.3.3
213
+ rubygems_version: 3.5.9
214
214
  signing_key:
215
215
  specification_version: 4
216
216
  summary: Upload apps to Amazon Appstore