fastlane-plugin-taiwan_number_one 0.1.2 → 0.2.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: bb753f703cb1ca29144e73ab02075eef0ba777a23005447ae29b71b7851c5469
4
- data.tar.gz: 8d62b2ac64f6ff3b45adeec927f060e0785ee75f9c0ecb7ca70ac3e7217abc10
3
+ metadata.gz: c476927219f7b1a3dcc7a6b5028143512ade17422dabd2068c1e17ed3694e9d3
4
+ data.tar.gz: c68e731269bfaa3dbe968aa439bc3259d2dfde16967ad3b7ebfa190eae36369e
5
5
  SHA512:
6
- metadata.gz: 8ab1d0603fcb11a782a795a50d2c8624428215b16d5132bf1658657ffc0c8eff78c51c19a6e21ae870d6040444f24085a914116c52c1c72e82eab623dced7f9d
7
- data.tar.gz: 5f947b531a3e54378f787addf6b12af3882d84fcb9b935f9f3d97b0105de5dac820bddfcb5208f100aa5b3319cd27e6e1fcf4b0487eb925c136915ceeac5ca87
6
+ metadata.gz: bf4d2fc1e683b7f2d7c39cedea1952342a89aae659c40095310ea1b6ba7cf6dc93febcc861157431229271a5727ffc48e2647299154ca5a84e4ca21b38a8c319
7
+ data.tar.gz: 6f8868bbdad6f94983f435816ecd3f8fef9475f90e87a3ece2f49584538655fa53f81d63b38159105a03eb30d655962958e823248e724b864261d4afe766fb02
data/README.md CHANGED
@@ -64,6 +64,24 @@ lane :release_decision do |options|
64
64
  end
65
65
  ```
66
66
 
67
+ or this:
68
+ ```
69
+ desc "reject App store version"
70
+ lane :reject_app do
71
+ api_key = app_store_connect_api_key(
72
+ key_id: ENV["ASC_API_KEY_ID"],
73
+ issuer_id: ENV["ISSUER_ID"],
74
+ key_content: ENV["ASC_API_KEY"]
75
+ )
76
+ release_decision(
77
+ app_decision: Fastlane::Actions::TaiwanNumberOneAction::DicisionType::REJECT,
78
+ api_key: api_key
79
+ )
80
+ end
81
+ ```
82
+
83
+ *for more info about app_store_connect_api_key, please refer to [here](http://docs.fastlane.tools/actions/app_store_connect_api_key/#app_store_connect_api_key) and [here](http://docs.fastlane.tools/app-store-connect-api/#using-an-app-store-connect-api-key)
84
+
67
85
  Since there might have some problem in `reject_if_possible` of `Deliver`, so it's better to call this Action before `Deliver` everytime.
68
86
 
69
87
  something like this:
@@ -105,6 +123,8 @@ username |Your Apple ID Username |
105
123
  app_identifier|The bundle identifier of your app |
106
124
  team_id |The ID of your App Store Connect team if you're in multiple teams. (optional)|
107
125
  team_name |The name of your App Store Connect team if you're in multiple teams. (optional)|
126
+ api_key_path |Path to your App Store Connect API Key JSON file (https://docs.fastlane.tools/app-store-connect-api/#using-fastlane-api-key-json-file) |
127
+ api_key |Your App Store Connect API Key information (https://docs.fastlane.tools/app-store-connect-api/#use-return-value-and-pass-in-as-an-option) |
108
128
 
109
129
  ## Run tests for this plugin
110
130
 
@@ -11,6 +11,8 @@ module Fastlane
11
11
  end
12
12
 
13
13
  def self.run(params)
14
+ params[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
15
+
14
16
  app_id = params.fetch(:app_identifier)
15
17
  username = params.fetch(:username)
16
18
  unless app_id && username
@@ -18,21 +20,20 @@ module Fastlane
18
20
  return
19
21
  end
20
22
 
21
- # Prompts select team if multiple teams and none specified
22
- UI.message("Login to App Store Connect (#{params[:username]})")
23
- Spaceship::ConnectAPI.login(
24
- params[:username],
25
- use_portal: false,
26
- use_tunes: true,
27
- tunes_team_id: params[:team_id],
28
- team_name: params[:team_name]
29
- )
30
- UI.message("Login successful")
31
-
32
- # Get App
33
- application = Spaceship::Application.find(app_id)
34
- unless application
35
- UI.user_error!("Could not find app with bundle identifier '#{app_id}' on account #{params[:username]}")
23
+ token = self.api_token(params)
24
+ if token
25
+ UI.message("Using App Store Connect API token...")
26
+ Spaceship::ConnectAPI.token = token
27
+ else
28
+ UI.message("Login to App Store Connect (#{params[:username]})")
29
+ Spaceship::ConnectAPI.login(
30
+ params[:username],
31
+ use_portal: false,
32
+ use_tunes: true,
33
+ tunes_team_id: params[:team_id],
34
+ team_name: params[:team_name]
35
+ )
36
+ UI.message("Login successful")
36
37
  end
37
38
 
38
39
  app = Spaceship::ConnectAPI::App.find(app_id)
@@ -62,7 +63,7 @@ module Fastlane
62
63
  case decision
63
64
  when DicisionType::RELEASE
64
65
  UI.message("decision is release")
65
- release_version_if_possible(app: application, app_store_version: app_store_version)
66
+ release_version_if_possible(app: app, app_store_version: app_store_version)
66
67
  when DicisionType::REJECT
67
68
  UI.message("decision is reject")
68
69
  reject_version_if_possible(app: app, app_store_version: app_store_version)
@@ -89,7 +90,7 @@ module Fastlane
89
90
  return DicisionType::REJECT
90
91
  end
91
92
  end
92
-
93
+
93
94
  def self.release_version_if_possible(app: nil, app_store_version: Spaceship::ConnectAPI::AppStoreVersion)
94
95
  unless app
95
96
  UI.user_error!("Could not find app with bundle identifier '#{params[:app_identifier]}' on account #{params[:username]}")
@@ -108,14 +109,21 @@ module Fastlane
108
109
  unless app
109
110
  UI.user_error!("Could not find app with bundle identifier '#{params[:app_identifier]}' on account #{params[:username]}")
110
111
  end
111
-
112
+
112
113
  if app_store_version.reject!
113
- UI.success("rejected version #{app_store_version} Successfully!")
114
+ UI.success("rejected version #{app_store_version.version_string} Successfully!")
114
115
  else
115
116
  UI.user_error!("An error occurred while rejected version #{app_store_version}")
116
117
  end
117
118
  end
118
119
 
120
+ def self.api_token(params)
121
+ params[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
122
+ api_token ||= Spaceship::ConnectAPI::Token.create(params[:api_key]) if params[:api_key]
123
+ api_token ||= Spaceship::ConnectAPI::Token.from_json_file(params[:api_key_path]) if params[:api_key_path]
124
+ return api_token
125
+ end
126
+
119
127
  def self.description
120
128
  "release or reject if status is Pending Developer Release."
121
129
  end
@@ -180,7 +188,22 @@ module Fastlane
180
188
  default_value_dynamic: true,
181
189
  verify_block: proc do |value|
182
190
  ENV["FASTLANE_ITC_TEAM_NAME"] = value.to_s
183
- end)
191
+ end),
192
+ FastlaneCore::ConfigItem.new(key: :api_key_path,
193
+ env_name: "FL_REGISTER_DEVICE_API_KEY_PATH",
194
+ description: "Path to your App Store Connect API Key JSON file (https://docs.fastlane.tools/app-store-connect-api/#using-fastlane-api-key-json-file)",
195
+ optional: true,
196
+ conflicting_options: [:api_key],
197
+ verify_block: proc do |value|
198
+ UI.user_error!("Couldn't find API key JSON file at path '#{value}'") unless File.exist?(value)
199
+ end),
200
+ FastlaneCore::ConfigItem.new(key: :api_key,
201
+ env_name: "FL_REGISTER_DEVICE_API_KEY",
202
+ description: "Your App Store Connect API Key information (https://docs.fastlane.tools/app-store-connect-api/#use-return-value-and-pass-in-as-an-option)",
203
+ type: Hash,
204
+ optional: true,
205
+ sensitive: true,
206
+ conflicting_options: [:api_key_path])
184
207
  ]
185
208
  end
186
209
 
@@ -194,7 +217,8 @@ module Fastlane
194
217
  def self.example_code
195
218
  [
196
219
  'taiwan_number_one(
197
- app_decision: "release", # Set to true to skip verification of HTML preview
220
+ app_decision: "release",
221
+ api_key: "api_key" # your app_store_connect_api_key
198
222
  )'
199
223
  ]
200
224
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module TaiwanNumberOne
3
- VERSION = "0.1.2"
3
+ VERSION = "0.2.0"
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.1.2
4
+ version: 0.2.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-03-13 00:00:00.000000000 Z
11
+ date: 2021-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry