fastlane-plugin-taiwan_number_one 0.2.5 → 1.0.1
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: c7a52ae95184c56210567ff8e07044f3211006e0c2573ae4bca75fe92e2fde95
|
4
|
+
data.tar.gz: 4566306d89b9d912349db6e51006e498b4504dc88e8b32504728807fbbcc4ef4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 994f6edc6152386ee0d3c1c571600e0a63dc6b28fa312c42a9d2d45f6afd2e076357b0ba75ce830cfb333ca3fd8a844f589274281586edddf659cc01b29e8e48
|
7
|
+
data.tar.gz: 74195ccb3f67a13e2e7a962a9e568247225d7497e6fece51661d924d26652a1b35a58d306f046c2173b918a01301fd0d9b7c9220049a23c7b52bfaa6956d04f5
|
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.
|
@@ -69,7 +70,7 @@ and this:
|
|
69
70
|
```
|
70
71
|
desc "release App store version"
|
71
72
|
lane :release_app do
|
72
|
-
result = release_decision(app_decision: Fastlane::Actions::TaiwanNumberOneAction::
|
73
|
+
result = release_decision(app_decision: Fastlane::Actions::TaiwanNumberOneAction::DecisionType::RELEASE)
|
73
74
|
if result == Fastlane::Actions::TaiwanNumberOneAction::ActionResult::SUCCESS
|
74
75
|
# do your thing here!
|
75
76
|
end
|
@@ -85,7 +86,7 @@ lane :reject_app do
|
|
85
86
|
issuer_id: ENV["ISSUER_ID"],
|
86
87
|
key_content: ENV["ASC_API_KEY"]
|
87
88
|
)
|
88
|
-
release_decision(app_decision: Fastlane::Actions::TaiwanNumberOneAction::
|
89
|
+
release_decision(app_decision: Fastlane::Actions::TaiwanNumberOneAction::DecisionType::REJECT)
|
89
90
|
end
|
90
91
|
```
|
91
92
|
|
@@ -107,9 +108,9 @@ end
|
|
107
108
|
or
|
108
109
|
|
109
110
|
```
|
110
|
-
release_decision(app_decision: Fastlane::Actions::TaiwanNumberOneAction::
|
111
|
+
release_decision(app_decision: Fastlane::Actions::TaiwanNumberOneAction::DecisionType::RELEASE)
|
111
112
|
|
112
|
-
release_decision(app_decision: Fastlane::Actions::TaiwanNumberOneAction::
|
113
|
+
release_decision(app_decision: Fastlane::Actions::TaiwanNumberOneAction::DecisionType::REJECT)
|
113
114
|
```
|
114
115
|
|
115
116
|
#### Use in terminal
|
@@ -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,16 @@ module Fastlane
|
|
53
53
|
].join(","),
|
54
54
|
platform: platform
|
55
55
|
}
|
56
|
+
|
57
|
+
decision ||= fetch_decision(params)
|
58
|
+
if params[:force] && decision == DecisionType::REJECT
|
59
|
+
UI.message("decision is reject")
|
60
|
+
app_store_version = app.get_app_store_versions(client: client, includes: "appStoreVersionSubmission")
|
61
|
+
.sort_by { |v| Gem::Version.new(v.version_string) }
|
62
|
+
.last
|
63
|
+
return reject_version_if_possible(app: app, app_store_version: app_store_version)
|
64
|
+
end
|
65
|
+
|
56
66
|
app_store_version = app.get_app_store_versions(client: client, filter: filter, includes: "appStoreVersionSubmission")
|
57
67
|
.sort_by { |v| Gem::Version.new(v.version_string) }
|
58
68
|
.last
|
@@ -63,16 +73,15 @@ module Fastlane
|
|
63
73
|
unless state == Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::PENDING_DEVELOPER_RELEASE
|
64
74
|
UI.message("AppStoreState is not PENDING_DEVELOPER_RELEASE")
|
65
75
|
UI.message("🇹🇼 Taiwan helps you do nothing!")
|
66
|
-
return
|
76
|
+
return ActionResult::DO_NOTHING
|
67
77
|
end
|
68
|
-
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
|
@@ -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
|
|
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.1
|
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-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|