fastlane-plugin-taiwan_number_one 0.2.4 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d5f839980b3d9ad947203474ba62973abaf7b768dafd9d17518761cb3482605
|
4
|
+
data.tar.gz: 70e6328b3fb8693a83d6979dadf51ac0e8fa47bd4d74b3403f15ac525611b196
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1535dc058ad8feb38de1d1c473db917f84e9afb01f5de45e9e4043b12332b67b15e173d2186974f8103cf120f11851f66d2880ceea135a0f87b935c5367c9bc0
|
7
|
+
data.tar.gz: 9bfbb71e768956fb71f98f42109535bec08fae6ab4dd64c801ae77860c71504d689e6d20b7dccf54a6d9a63872d0a9574d2eade3dd95d1ffd02bbbd024bd1c42
|
data/README.md
CHANGED
@@ -10,6 +10,7 @@ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To
|
|
10
10
|
fastlane add_plugin taiwan_number_one
|
11
11
|
```
|
12
12
|
|
13
|
+
Start from v0.2.7 we use this [workaround](https://github.com/fastlane/fastlane/issues/17283#issuecomment-711865915) to solve issue while using App Store Connect Api key.
|
13
14
|
## About taiwan_number_one
|
14
15
|
|
15
16
|
To approve or reject if status is `Pending Developer Release`, otherwise do nothing.
|
@@ -1,10 +1,11 @@
|
|
1
1
|
require "fastlane/action"
|
2
|
+
require "spaceship"
|
2
3
|
require_relative "../helper/taiwan_number_one_helper"
|
3
4
|
|
4
5
|
module Fastlane
|
5
6
|
module Actions
|
6
7
|
class TaiwanNumberOneAction < Action
|
7
|
-
module
|
8
|
+
module DecisionType
|
8
9
|
RELEASE = "release"
|
9
10
|
REJECT = "reject"
|
10
11
|
end
|
@@ -15,7 +16,6 @@ module Fastlane
|
|
15
16
|
end
|
16
17
|
|
17
18
|
def self.run(params)
|
18
|
-
require 'spaceship'
|
19
19
|
begin
|
20
20
|
params[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
|
21
21
|
|
@@ -53,6 +53,15 @@ module Fastlane
|
|
53
53
|
].join(","),
|
54
54
|
platform: platform
|
55
55
|
}
|
56
|
+
|
57
|
+
if params[:force] && decision == DecisionType::REJECT
|
58
|
+
UI.message("decision is reject")
|
59
|
+
app_store_version = app.get_app_store_versions(client: client, includes: "appStoreVersionSubmission")
|
60
|
+
.sort_by { |v| Gem::Version.new(v.version_string) }
|
61
|
+
.last
|
62
|
+
return reject_version_if_possible(app: app, app_store_version: app_store_version)
|
63
|
+
end
|
64
|
+
|
56
65
|
app_store_version = app.get_app_store_versions(client: client, filter: filter, includes: "appStoreVersionSubmission")
|
57
66
|
.sort_by { |v| Gem::Version.new(v.version_string) }
|
58
67
|
.last
|
@@ -63,16 +72,16 @@ module Fastlane
|
|
63
72
|
unless state == Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::PENDING_DEVELOPER_RELEASE
|
64
73
|
UI.message("AppStoreState is not PENDING_DEVELOPER_RELEASE")
|
65
74
|
UI.message("🇹🇼 Taiwan helps you do nothing!")
|
66
|
-
return
|
75
|
+
return ActionResult::DO_NOTHING
|
67
76
|
end
|
68
|
-
decision ||= fetch_decision(
|
77
|
+
decision ||= fetch_decision(params)
|
69
78
|
|
70
79
|
result = ActionResult::DO_NOTHING
|
71
80
|
case decision
|
72
|
-
when
|
81
|
+
when DecisionType::RELEASE
|
73
82
|
UI.message("decision is release")
|
74
|
-
result = release_version_if_possible(app: app, app_store_version: app_store_version)
|
75
|
-
when
|
83
|
+
result = release_version_if_possible(app: app, app_store_version: app_store_version, token: token)
|
84
|
+
when DecisionType::REJECT
|
76
85
|
UI.message("decision is reject")
|
77
86
|
result = reject_version_if_possible(app: app, app_store_version: app_store_version)
|
78
87
|
else
|
@@ -96,7 +105,7 @@ module Fastlane
|
|
96
105
|
end
|
97
106
|
end
|
98
107
|
|
99
|
-
def self.fetch_decision(
|
108
|
+
def self.fetch_decision(params)
|
100
109
|
decision = params[:app_decision]
|
101
110
|
until ["release", "reject"].include?(decision)
|
102
111
|
UI.user_error!("App's decision must be release or reject.")
|
@@ -104,23 +113,33 @@ module Fastlane
|
|
104
113
|
end
|
105
114
|
# return decision
|
106
115
|
UI.message("return type #{decision}")
|
107
|
-
if decision ==
|
108
|
-
return
|
116
|
+
if decision == DecisionType::RELEASE
|
117
|
+
return DecisionType::RELEASE
|
109
118
|
else
|
110
|
-
return
|
119
|
+
return DecisionType::REJECT
|
111
120
|
end
|
112
121
|
end
|
113
122
|
|
114
|
-
def self.release_version_if_possible(app: nil, app_store_version: Spaceship::ConnectAPI::AppStoreVersion)
|
123
|
+
def self.release_version_if_possible(app: nil, app_store_version: Spaceship::ConnectAPI::AppStoreVersion, token: nil)
|
115
124
|
unless app
|
116
125
|
UI.user_error!("Could not find app with bundle identifier '#{params[:app_identifier]}' on account #{params[:username]}")
|
117
126
|
return ActionResult::DO_NOTHING
|
118
127
|
end
|
119
128
|
|
120
129
|
begin
|
121
|
-
|
122
|
-
|
123
|
-
|
130
|
+
if token
|
131
|
+
now = Time.now
|
132
|
+
release_date_string = now.strftime("%Y-%m-%dT%H:00%:z")
|
133
|
+
app_store_version.update(attributes: {
|
134
|
+
earliest_release_date: release_date_string,
|
135
|
+
release_type: Spaceship::ConnectAPI::AppStoreVersion::ReleaseType::SCHEDULED
|
136
|
+
})
|
137
|
+
return ActionResult::SUCCESS
|
138
|
+
else
|
139
|
+
app_store_version.create_app_store_version_release_request
|
140
|
+
UI.message("release version #{app_store_version.version_string} successfully!")
|
141
|
+
return ActionResult::SUCCESS
|
142
|
+
end
|
124
143
|
rescue => e
|
125
144
|
UI.user_error!("An error occurred while releasing version #{app_store_version}, #{e.message}\n#{e.backtrace.join("\n")}")
|
126
145
|
return ActionResult::DO_NOTHING
|
@@ -180,7 +199,7 @@ module Fastlane
|
|
180
199
|
env_name: "app_decision",
|
181
200
|
description: "A description of your decision, should be release or reject",
|
182
201
|
optional: false,
|
183
|
-
default_value:
|
202
|
+
default_value: DecisionType::RELEASE,
|
184
203
|
type: String),
|
185
204
|
FastlaneCore::ConfigItem.new(key: :username,
|
186
205
|
short_option: "-u",
|
@@ -234,7 +253,12 @@ module Fastlane
|
|
234
253
|
type: Hash,
|
235
254
|
optional: true,
|
236
255
|
sensitive: true,
|
237
|
-
conflicting_options: [:api_key_path])
|
256
|
+
conflicting_options: [:api_key_path]),
|
257
|
+
FastlaneCore::ConfigItem.new(key: :force,
|
258
|
+
env_name: "FL_DECISION_FORCE",
|
259
|
+
description: "Skip verifying of current version state for reject reviewed version or cancel waiting review version",
|
260
|
+
is_string: false,
|
261
|
+
default_value: false),
|
238
262
|
]
|
239
263
|
end
|
240
264
|
|
@@ -249,7 +273,7 @@ module Fastlane
|
|
249
273
|
[
|
250
274
|
'taiwan_number_one(
|
251
275
|
app_decision: "release",
|
252
|
-
api_key: "api_key" # your app_store_connect_api_key
|
276
|
+
api_key: "api_key" # your app_store_connect_api_key
|
253
277
|
)'
|
254
278
|
]
|
255
279
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-taiwan_number_one
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- andrew54068
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|