fastlane-plugin-taiwan_number_one 0.2.6 → 1.1.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: 30a7efee5d2102888aacc0c475d952729991da41eae2010bcdbcb289e56392ce
4
- data.tar.gz: '0976e6fcddb1bf2bc35ed104324debc8a8e04718cbbd5347f30d2512b7e0b624'
3
+ metadata.gz: f021f730281d3fb9f0494a897ed7d2150954a9dd671c1d3f334389ce3b22ec37
4
+ data.tar.gz: 27bb6277be25f03f4d1a0ec2c35377be6ea262e33ef6857a0df1142806de5bcf
5
5
  SHA512:
6
- metadata.gz: 9ec00137f9b533afe8fcc910d7eb4109ba387a651c1413e457b132de0f61563afd63caf6a6693b1c67ce2c83c91c1b23735cc608ae16cf3c3ca756028b440f10
7
- data.tar.gz: f933489a34359b0374d0b63740888a4e0e1565410502c7c90d6f261149ac007dbe984fd9a6a10375774244fb942adecd1c2b9042d465bb9535fc5ec7b47cb8ea
6
+ metadata.gz: 50dedbd50733a4ae7c209dc2e2b5724a167a1d70c41ad8f5c702f0620d2d2aecb2b87d5f66ebc4e6a68d5d23e6b43a763c2b586e1312299421d11d4506794988
7
+ data.tar.gz: 53120452faa6d1d9d6c6601cc865ffaeb4b1e2b35b870c2524969ccde60b807dba892fece311467927648db69dc9cf79f0b3a31a414bfaa26649c3770390cb4e
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::DicisionType::RELEASE)
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::DicisionType::REJECT)
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::DicisionType::RELEASE)
111
+ release_decision(app_decision: Fastlane::Actions::TaiwanNumberOneAction::DecisionType::RELEASE)
111
112
 
112
- release_decision(app_decision: Fastlane::Actions::TaiwanNumberOneAction::DicisionType::REJECT)
113
+ release_decision(app_decision: Fastlane::Actions::TaiwanNumberOneAction::DecisionType::REJECT)
113
114
  ```
114
115
 
115
116
  #### Use in terminal
@@ -5,7 +5,7 @@ require_relative "../helper/taiwan_number_one_helper"
5
5
  module Fastlane
6
6
  module Actions
7
7
  class TaiwanNumberOneAction < Action
8
- module DicisionType
8
+ module DecisionType
9
9
  RELEASE = "release"
10
10
  REJECT = "reject"
11
11
  end
@@ -53,6 +53,21 @@ 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
+ if app_store_version.app_store_state == Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::DEVELOPER_REJECTED
64
+ UI.message("app_store_state is already #{app_store_version.app_store_state}")
65
+ UI.message("🇹🇼 Taiwan helps you do nothing!")
66
+ return ActionResult::DO_NOTHING
67
+ end
68
+ return reject_version_if_possible(app: app, app_store_version: app_store_version)
69
+ end
70
+
56
71
  app_store_version = app.get_app_store_versions(client: client, filter: filter, includes: "appStoreVersionSubmission")
57
72
  .sort_by { |v| Gem::Version.new(v.version_string) }
58
73
  .last
@@ -63,16 +78,15 @@ module Fastlane
63
78
  unless state == Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::PENDING_DEVELOPER_RELEASE
64
79
  UI.message("AppStoreState is not PENDING_DEVELOPER_RELEASE")
65
80
  UI.message("🇹🇼 Taiwan helps you do nothing!")
66
- return
81
+ return ActionResult::DO_NOTHING
67
82
  end
68
- decision ||= fetch_decision(params)
69
83
 
70
84
  result = ActionResult::DO_NOTHING
71
85
  case decision
72
- when DicisionType::RELEASE
86
+ when DecisionType::RELEASE
73
87
  UI.message("decision is release")
74
- result = release_version_if_possible(app: app, app_store_version: app_store_version)
75
- when DicisionType::REJECT
88
+ result = release_version_if_possible(app: app, app_store_version: app_store_version, token: token)
89
+ when DecisionType::REJECT
76
90
  UI.message("decision is reject")
77
91
  result = reject_version_if_possible(app: app, app_store_version: app_store_version)
78
92
  else
@@ -104,23 +118,33 @@ module Fastlane
104
118
  end
105
119
  # return decision
106
120
  UI.message("return type #{decision}")
107
- if decision == DicisionType::RELEASE
108
- return DicisionType::RELEASE
121
+ if decision == DecisionType::RELEASE
122
+ return DecisionType::RELEASE
109
123
  else
110
- return DicisionType::REJECT
124
+ return DecisionType::REJECT
111
125
  end
112
126
  end
113
127
 
114
- def self.release_version_if_possible(app: nil, app_store_version: Spaceship::ConnectAPI::AppStoreVersion)
128
+ def self.release_version_if_possible(app: nil, app_store_version: Spaceship::ConnectAPI::AppStoreVersion, token: nil)
115
129
  unless app
116
130
  UI.user_error!("Could not find app with bundle identifier '#{params[:app_identifier]}' on account #{params[:username]}")
117
131
  return ActionResult::DO_NOTHING
118
132
  end
119
133
 
120
134
  begin
121
- app_store_version.create_app_store_version_release_request
122
- UI.message("release version #{app_store_version.version_string} successfully!")
123
- return ActionResult::SUCCESS
135
+ if token
136
+ now = Time.now
137
+ release_date_string = now.strftime("%Y-%m-%dT%H:00%:z")
138
+ app_store_version.update(attributes: {
139
+ earliest_release_date: release_date_string,
140
+ release_type: Spaceship::ConnectAPI::AppStoreVersion::ReleaseType::SCHEDULED
141
+ })
142
+ return ActionResult::SUCCESS
143
+ else
144
+ app_store_version.create_app_store_version_release_request
145
+ UI.message("release version #{app_store_version.version_string} successfully!")
146
+ return ActionResult::SUCCESS
147
+ end
124
148
  rescue => e
125
149
  UI.user_error!("An error occurred while releasing version #{app_store_version}, #{e.message}\n#{e.backtrace.join("\n")}")
126
150
  return ActionResult::DO_NOTHING
@@ -180,7 +204,7 @@ module Fastlane
180
204
  env_name: "app_decision",
181
205
  description: "A description of your decision, should be release or reject",
182
206
  optional: false,
183
- default_value: DicisionType::RELEASE,
207
+ default_value: DecisionType::RELEASE,
184
208
  type: String),
185
209
  FastlaneCore::ConfigItem.new(key: :username,
186
210
  short_option: "-u",
@@ -234,7 +258,12 @@ module Fastlane
234
258
  type: Hash,
235
259
  optional: true,
236
260
  sensitive: true,
237
- conflicting_options: [:api_key_path])
261
+ conflicting_options: [:api_key_path]),
262
+ FastlaneCore::ConfigItem.new(key: :force,
263
+ env_name: "FL_DECISION_FORCE",
264
+ description: "Skip verifying of current version state for reject reviewed version or cancel waiting review version",
265
+ is_string: false,
266
+ default_value: false),
238
267
  ]
239
268
  end
240
269
 
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module TaiwanNumberOne
3
- VERSION = "0.2.6"
3
+ VERSION = "1.1.1"
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.6
4
+ version: 1.1.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-03-30 00:00:00.000000000 Z
11
+ date: 2021-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry