fastlane-plugin-taiwan_number_one 0.2.2 → 0.2.7

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: 698fe9ed45a02263ec080d0cb79ecddcf4bd668642608df48d3a7e26df3e131c
4
- data.tar.gz: a94da99582b601d965cb9dbb4262ffd5e05edc42128aeb80b5b4ae4600738618
3
+ metadata.gz: 29c9d03d5a2a3660d0b4e40788ed3d4459c08f2334d8d4f66350df8dbd58c8d9
4
+ data.tar.gz: '05458abd7384ce522b853a35d69de92bae36bbaab821f400d69881d1f8e59c70'
5
5
  SHA512:
6
- metadata.gz: b2235de3b0a0eff7e9c2795bb20153b5338a12d8460c5275bd1f9b8ec50894359b8c777c417acf1d7a9a6a1cca9c8a5dc65f0af5a01f92f52c7fedc0877f7f03
7
- data.tar.gz: 6cb3f0ce091c9779a5a0a07f1c7b43427f124ff8d4e4a6374c9496c70d214a3e851f39b565a049a2a289bfe296b7d1bc5dec40b3316aa2c160332086710e35e7
6
+ metadata.gz: 9b972ebe636be3276847abf501996e662822a163b4bee572b88557fa7477352f7e7aa3a83c160fdaca169dc9ad2ce3869a34c7527f7255b9f4daabf3a4daabc7
7
+ data.tar.gz: b98462a5fb3438b0bb3dc6c21586ef0af9e07e90f5c59c14b7c9a1ac78e457e562a807a1938f232782781925639d41c2c12624419307ac69ccc7dc597f562cae
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,5 +1,5 @@
1
1
  require "fastlane/action"
2
- require "Spaceship"
2
+ require "spaceship"
3
3
  require_relative "../helper/taiwan_number_one_helper"
4
4
 
5
5
  module Fastlane
@@ -62,16 +62,16 @@ module Fastlane
62
62
  UI.message("version #{version_string} is #{state}")
63
63
  unless state == Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::PENDING_DEVELOPER_RELEASE
64
64
  UI.message("AppStoreState is not PENDING_DEVELOPER_RELEASE")
65
+ UI.message("🇹🇼 Taiwan helps you do nothing!")
65
66
  return
66
67
  end
67
- decision = params[:app_decision]
68
- decision ||= fetch_decision
68
+ decision ||= fetch_decision(params)
69
69
 
70
70
  result = ActionResult::DO_NOTHING
71
71
  case decision
72
72
  when DicisionType::RELEASE
73
73
  UI.message("decision is release")
74
- result = release_version_if_possible(app: app, app_store_version: app_store_version)
74
+ result = release_version_if_possible(app: app, app_store_version: app_store_version, token: token)
75
75
  when DicisionType::REJECT
76
76
  UI.message("decision is reject")
77
77
  result = reject_version_if_possible(app: app, app_store_version: app_store_version)
@@ -81,22 +81,25 @@ module Fastlane
81
81
  end
82
82
 
83
83
  UI.message("The taiwan_number_one plugin action is finished!")
84
+ UI.message("🇹🇼 Taiwan can help!")
84
85
  return result
85
86
  else
86
87
  UI.message("no pending release version exist.")
87
88
  UI.message("The taiwan_number_one plugin action is finished!")
89
+ UI.message("🇹🇼 Taiwan can help!")
88
90
  return ActionResult::DO_NOTHING
89
91
  end
90
92
  rescue => error
93
+ UI.message("🇹🇼 Taiwan might not be able to help you with this...")
91
94
  UI.user_error!("The taiwan_number_one plugin action is finished with error: #{error.message}!")
92
95
  return ActionResult::DO_NOTHING
93
96
  end
94
97
  end
95
98
 
96
- def self.fetch_decision
97
- decision = nil
99
+ def self.fetch_decision(params)
100
+ decision = params[:app_decision]
98
101
  until ["release", "reject"].include?(decision)
99
- UI.user_error!("App's decision must be release or reject")
102
+ UI.user_error!("App's decision must be release or reject.")
100
103
  return
101
104
  end
102
105
  # return decision
@@ -108,16 +111,26 @@ module Fastlane
108
111
  end
109
112
  end
110
113
 
111
- def self.release_version_if_possible(app: nil, app_store_version: Spaceship::ConnectAPI::AppStoreVersion)
114
+ def self.release_version_if_possible(app: nil, app_store_version: Spaceship::ConnectAPI::AppStoreVersion, token: nil)
112
115
  unless app
113
116
  UI.user_error!("Could not find app with bundle identifier '#{params[:app_identifier]}' on account #{params[:username]}")
114
117
  return ActionResult::DO_NOTHING
115
118
  end
116
119
 
117
120
  begin
118
- app_store_version.create_app_store_version_release_request
119
- UI.message("release version #{app_store_version.version_string} successfully!")
120
- return ActionResult::SUCCESS
121
+ if token
122
+ now = Time.now
123
+ release_date_string = now.strftime("%Y-%m-%dT%H:00%:z")
124
+ app_store_version.update(attributes: {
125
+ earliest_release_date: release_date_string,
126
+ release_type: Spaceship::ConnectAPI::AppStoreVersion::ReleaseType::SCHEDULED
127
+ })
128
+ return ActionResult::SUCCESS
129
+ else
130
+ app_store_version.create_app_store_version_release_request
131
+ UI.message("release version #{app_store_version.version_string} successfully!")
132
+ return ActionResult::SUCCESS
133
+ end
121
134
  rescue => e
122
135
  UI.user_error!("An error occurred while releasing version #{app_store_version}, #{e.message}\n#{e.backtrace.join("\n")}")
123
136
  return ActionResult::DO_NOTHING
@@ -159,10 +172,16 @@ module Fastlane
159
172
  end
160
173
 
161
174
  def self.details
162
- # Optional:
163
175
  "use fastlane to release or reject reviewed version"
164
176
  end
165
177
 
178
+ def self.output
179
+ [
180
+ [ActionResult::SUCCESS, 'Successfully release or reject.'],
181
+ [ActionResult::DO_NOTHING, 'Do nothing.']
182
+ ]
183
+ end
184
+
166
185
  def self.available_options
167
186
  user = CredentialsManager::AppfileConfig.try_fetch_value(:itunes_connect_id)
168
187
  user ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)
@@ -240,7 +259,7 @@ module Fastlane
240
259
  [
241
260
  'taiwan_number_one(
242
261
  app_decision: "release",
243
- api_key: "api_key" # your app_store_connect_api_key
262
+ api_key: "api_key" # your app_store_connect_api_key
244
263
  )'
245
264
  ]
246
265
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module TaiwanNumberOne
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.7"
4
4
  end
5
5
  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.2.2
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - andrew54068
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-23 00:00:00.000000000 Z
11
+ date: 2021-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry