fastlane-plugin-taiwan_number_one 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f1747d4598e6ab056cc1250a135c930e0f551e990c2d9c700a64ec920c393fcd
4
+ data.tar.gz: 8cf6b8d22266a4a98cee49e9dce576a9667bb8417b6858adc2be0aead9378651
5
+ SHA512:
6
+ metadata.gz: 8727b5bf9b93db5fc8315a7106a32f190c2a55076e853f9031dd2dba293d53bc08b64a4a8224482bcb604a82a7aff190282e8b4cda79ab68e4e8d3653a3777e4
7
+ data.tar.gz: fe1b47c93f05c3e0427c8342233626d62a6a0224330d5662f0f3d6d737f986ab3f614f7560ba08daa14fc078fe236069ca4a8fcb2c770e7106dc11ef4dc87b44
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 andrew54068 <andrew0424718012@yahoo.com.tw>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,124 @@
1
+ # taiwan_number_one plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-taiwan_number_one)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-taiwan_number_one`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin taiwan_number_one
11
+ ```
12
+
13
+ ## About taiwan_number_one
14
+
15
+ To approve or reject if status is Pending Developer Release.
16
+
17
+ #### This feature is requsted for a while:
18
+
19
+ Release app using fast lane (change status from "Pending Developer Release" to released
20
+ https://github.com/fastlane/fastlane/issues/11842
21
+
22
+ Ability to "Release This Version" from "Pending Developer Release"
23
+ https://github.com/fastlane/fastlane/issues/3481
24
+
25
+ Cancel "Pending developer release"?
26
+ https://developer.apple.com/forums/thread/53463
27
+
28
+ deliver not updating version number if app Pending Developer Release
29
+ https://github.com/fastlane/fastlane/issues/14154
30
+
31
+ [Deliver] - Not able to reject the app version which is in Pending Developer Release
32
+ https://github.com/fastlane/fastlane/issues/17539
33
+
34
+ ## Usage
35
+
36
+ ##### Show info
37
+
38
+ ```
39
+ bundle exec fastlane action taiwan_number_one
40
+ ```
41
+
42
+ ##### Use in a Fastfile
43
+
44
+ you can create a custom lane like this:
45
+ ```
46
+ desc "handle app release decision"
47
+ lane :release_decision do |options|
48
+ taiwan_number_one(
49
+ username: username,
50
+ app_identifier: app_identifier,
51
+ app_decision: options[:app_decision]
52
+ )
53
+ end
54
+ ```
55
+
56
+ Since there might have some problem in `reject_if_possible` of `Deliver`, so it's better to call this Action before `Deliver` everytime.
57
+
58
+ something like this:
59
+ ```
60
+ desc "build and upload production app with info to App Store Connet"
61
+ lane :upload_production_and_testFlight do |options|
62
+ ...
63
+ release_decision(app_decision: options[:app_decision])
64
+ deliver(...)
65
+ ...
66
+ end
67
+ ```
68
+
69
+ or
70
+
71
+ ```
72
+ release_decision(app_decision: Fastlane::Actions::TaiwanNumberOneAction::DicisionType::RELEASE)
73
+
74
+ release_decision(app_decision: Fastlane::Actions::TaiwanNumberOneAction::DicisionType::REJECT)
75
+ ```
76
+
77
+ #### Use in terminal
78
+
79
+ Run `taiwan_number_one` to release or reject only when the reviewed version status is `Pending Developer Release`, otherwise do nothing.
80
+
81
+ ```
82
+ bundle exec fastlane release_decision app_decision:"reject" username:"your apple id" app_identifier:"bundle id"
83
+ bundle exec fastlane release_decision app_decision:"release" username:"your apple id" app_identifier:"bundle id"
84
+ ```
85
+
86
+ ##### Default values
87
+ `taiwan_number_one` has a default `release` app_decision, which allow you to release the `Pending Developer Release` version when you don’t provide a specific app_decision value.
88
+
89
+ ## Parameters
90
+ Key | Description | Default |
91
+ --------------|:----------------------:|------------------------
92
+ app_decision |A description of your decision, should be release or reject. |release|
93
+ username |Your Apple ID Username |
94
+ app_identifier|The bundle identifier of your app |
95
+ team_id |The ID of your App Store Connect team if you're in multiple teams. (optional)|
96
+ team_name |The name of your App Store Connect team if you're in multiple teams. (optional)|
97
+
98
+ ## Run tests for this plugin
99
+
100
+ Not supported right now.
101
+
102
+ ## Issues and Feedback
103
+
104
+ For any other issues and feedback about this plugin, please submit it to this repository.
105
+
106
+ ## Troubleshooting
107
+
108
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
109
+
110
+ ## Using _fastlane_ Plugins
111
+
112
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
113
+
114
+ ## About _fastlane_
115
+
116
+ _fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
117
+
118
+ ## Contributing
119
+
120
+ Simply create a PR. I'll take a look as soon as possible.
121
+
122
+ ## Contact
123
+
124
+ andrew0424718012@yahoo.com.tw
@@ -0,0 +1,16 @@
1
+ require 'fastlane/plugin/taiwan_number_one/version'
2
+
3
+ module Fastlane
4
+ module TaiwanNumberOne
5
+ # Return all .rb files inside the "actions" and "helper" directory
6
+ def self.all_classes
7
+ Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
8
+ end
9
+ end
10
+ end
11
+
12
+ # By default we want to import all available actions and helpers
13
+ # A plugin can contain any number of actions and plugins
14
+ Fastlane::TaiwanNumberOne.all_classes.each do |current|
15
+ require current
16
+ end
@@ -0,0 +1,205 @@
1
+ require "fastlane/action"
2
+ require "Spaceship/client"
3
+ require_relative "../helper/taiwan_number_one_helper"
4
+
5
+ module Fastlane
6
+ module Actions
7
+ class TaiwanNumberOneAction < Action
8
+ module DicisionType
9
+ RELEASE = "release"
10
+ REJECT = "reject"
11
+ end
12
+
13
+ def self.run(params)
14
+ require "spaceship"
15
+
16
+ app_id = params[:app_identifier]
17
+
18
+ # Prompts select team if multiple teams and none specified
19
+ UI.message("Login to App Store Connect (#{params[:username]})")
20
+ Spaceship::ConnectAPI.login(
21
+ params[:username],
22
+ use_portal: false,
23
+ use_tunes: true,
24
+ tunes_team_id: params[:team_id],
25
+ team_name: params[:team_name]
26
+ )
27
+ UI.message("Login successful")
28
+
29
+ # Get App
30
+ application = Spaceship::Application.find(app_id)
31
+ unless application
32
+ UI.user_error!("Could not find app with bundle identifier '#{app_id}' on account #{params[:username]}")
33
+ end
34
+
35
+ app = Spaceship::ConnectAPI::App.find(app_id)
36
+ version = app.get_app_store_versions.first
37
+ UI.message("app_store_state is #{version.app_store_state}")
38
+ UI.message("version string is #{version.version_string}")
39
+ UI.message("pending version is #{version}")
40
+ client ||= Spaceship::ConnectAPI
41
+ platform ||= Spaceship::ConnectAPI::Platform::IOS
42
+ filter = {
43
+ appStoreState: [
44
+ Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::PENDING_DEVELOPER_RELEASE
45
+ ].join(","),
46
+ platform: platform
47
+ }
48
+ app_store_version = app.get_app_store_versions(client: client, filter: filter, includes: "appStoreVersionSubmission")
49
+ .sort_by { |v| Gem::Version.new(v.version_string) }
50
+ .last
51
+ if app_store_version
52
+ UI.message("app_store_version is #{app_store_version}")
53
+ state = app_store_version.app_store_state
54
+ UI.message("state is #{state}")
55
+
56
+ version_string = app_store_version.version_string
57
+ UI.message("version_string is #{version_string}")
58
+ unless state == Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::PENDING_DEVELOPER_RELEASE
59
+ UI.message("AppStoreState is not PENDING_DEVELOPER_RELEASE")
60
+ return
61
+ end
62
+ decision = params[:app_decision]
63
+ decision ||= get_decision
64
+ case decision
65
+ when DicisionType::RELEASE
66
+ UI.message("decision is release")
67
+ when DicisionType::REJECT
68
+ UI.message("decision is reject")
69
+ else
70
+ decision ||= get_decision
71
+ end
72
+ release_version_if_possible(app: application, app_store_version: app_store_version) if decision == "release"
73
+ reject_version_if_possible(app: application) if decision == "reject"
74
+
75
+ UI.message("The taiwan_number_one plugin is finished!")
76
+ else
77
+ UI.message("no pending release version exist.")
78
+ end
79
+
80
+ end
81
+
82
+ def self.get_decision()
83
+ decision = nil
84
+ until ["release", "reject"].include?(decision)
85
+ decision = UI.input("Please enter the app's release decision (release, reject): ")
86
+ UI.message("App's decision must be release or reject")
87
+ end
88
+ # return decision
89
+ if decision == DicisionType::RELEASE
90
+ UI.message("return type #{decision}")
91
+ return DicisionType::RELEASE
92
+ else
93
+ UI.message("return type #{decision}")
94
+ return DicisionType::REJECT
95
+ end
96
+ end
97
+
98
+ def self.reject_version_if_possible(app: nil)
99
+ unless app
100
+ UI.user_error!("Could not find app with bundle identifier '#{params[:app_identifier]}' on account #{params[:username]}")
101
+ end
102
+ if app.reject_version_if_possible!
103
+ UI.success("Successfully rejected previous version!")
104
+ end
105
+ end
106
+
107
+ def self.release_version_if_possible(app: nil, app_store_version: Spaceship::ConnectAPI::AppStoreVersion)
108
+ unless app
109
+ UI.user_error!("Could not find app with bundle identifier '#{params[:app_identifier]}' on account #{params[:username]}")
110
+ end
111
+ model = app_store_version.create_app_store_version_release_request
112
+ UI.success("response model is #{model}")
113
+
114
+ # release(version_id: version_id)
115
+ # if
116
+ UI.success("Successfully released previous version!")
117
+ # end
118
+ end
119
+
120
+ def self.description
121
+ "release or reject if status is Pending Developer Release."
122
+ end
123
+
124
+ def self.authors
125
+ ["andrew54068"]
126
+ end
127
+
128
+ def self.return_value
129
+ # If your method provides a return value, you can describe here what it does
130
+ end
131
+
132
+ def self.details
133
+ # Optional:
134
+ "use fastlane to release or reject reviewed version"
135
+ end
136
+
137
+ def self.available_options
138
+ user = CredentialsManager::AppfileConfig.try_fetch_value(:itunes_connect_id)
139
+ user ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)
140
+ [
141
+ FastlaneCore::ConfigItem.new(key: :app_decision,
142
+ short_option: "-d",
143
+ env_name: "app_decision",
144
+ description: "A description of your decision, should be release or reject",
145
+ optional: false,
146
+ default_value: DicisionType::RELEASE,
147
+ type: String),
148
+ FastlaneCore::ConfigItem.new(key: :username,
149
+ short_option: "-u",
150
+ env_name: "username",
151
+ description: "Your Apple ID Username",
152
+ default_value: user,
153
+ default_value_dynamic: true),
154
+ FastlaneCore::ConfigItem.new(key: :app_identifier,
155
+ short_option: "-a",
156
+ env_name: "app_identifier",
157
+ description: "The bundle identifier of your app",
158
+ optional: true,
159
+ code_gen_sensitive: true,
160
+ default_value: CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier),
161
+ default_value_dynamic: true),
162
+ # affiliation
163
+ FastlaneCore::ConfigItem.new(key: :team_id,
164
+ short_option: "-k",
165
+ env_name: "team_id",
166
+ description: "The ID of your App Store Connect team if you're in multiple teams",
167
+ optional: true,
168
+ is_string: false, # as we also allow integers, which we convert to strings anyway
169
+ code_gen_sensitive: true,
170
+ default_value: CredentialsManager::AppfileConfig.try_fetch_value(:itc_team_id),
171
+ default_value_dynamic: true,
172
+ verify_block: proc do |value|
173
+ ENV["FASTLANE_ITC_TEAM_ID"] = value.to_s
174
+ end),
175
+ FastlaneCore::ConfigItem.new(key: :team_name,
176
+ short_option: "-e",
177
+ env_name: "team_name",
178
+ description: "The name of your App Store Connect team if you're in multiple teams",
179
+ optional: true,
180
+ code_gen_sensitive: true,
181
+ default_value: CredentialsManager::AppfileConfig.try_fetch_value(:itc_team_name),
182
+ default_value_dynamic: true,
183
+ verify_block: proc do |value|
184
+ ENV["FASTLANE_ITC_TEAM_NAME"] = value.to_s
185
+ end)
186
+ ]
187
+ end
188
+
189
+ def self.is_supported?(platform)
190
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
191
+ # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
192
+ #
193
+ [:ios, :mac].include?(platform)
194
+ end
195
+
196
+ def self.example_code
197
+ [
198
+ 'taiwan_number_one(
199
+ app_decision: "release", # Set to true to skip verification of HTML preview
200
+ )'
201
+ ]
202
+ end
203
+ end
204
+ end
205
+ end
@@ -0,0 +1,16 @@
1
+ require 'fastlane_core/ui/ui'
2
+
3
+ module Fastlane
4
+ UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
5
+
6
+ module Helper
7
+ class TaiwanNumberOneHelper
8
+ # class methods that you define here become available in your action
9
+ # as `Helper::TaiwanNumberOneHelper.your_method`
10
+ #
11
+ def self.show_message
12
+ UI.message("Hello from the taiwan_number_one plugin helper!")
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module TaiwanNumberOne
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,174 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-taiwan_number_one
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - andrew54068
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-03-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pry
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec_junit_formatter
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '='
88
+ - !ruby/object:Gem::Version
89
+ version: 0.49.1
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 0.49.1
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-require_tools
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: simplecov
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: fastlane
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: 2.171.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: 2.171.0
139
+ description:
140
+ email: andrew0424718012@yahoo.com.tw
141
+ executables: []
142
+ extensions: []
143
+ extra_rdoc_files: []
144
+ files:
145
+ - LICENSE
146
+ - README.md
147
+ - lib/fastlane/plugin/taiwan_number_one.rb
148
+ - lib/fastlane/plugin/taiwan_number_one/actions/taiwan_number_one_action.rb
149
+ - lib/fastlane/plugin/taiwan_number_one/helper/taiwan_number_one_helper.rb
150
+ - lib/fastlane/plugin/taiwan_number_one/version.rb
151
+ homepage: https://github.com/andrew54068/fastlane-plugin-taiwan_number_one
152
+ licenses:
153
+ - MIT
154
+ metadata: {}
155
+ post_install_message:
156
+ rdoc_options: []
157
+ require_paths:
158
+ - lib
159
+ required_ruby_version: !ruby/object:Gem::Requirement
160
+ requirements:
161
+ - - ">="
162
+ - !ruby/object:Gem::Version
163
+ version: '0'
164
+ required_rubygems_version: !ruby/object:Gem::Requirement
165
+ requirements:
166
+ - - ">="
167
+ - !ruby/object:Gem::Version
168
+ version: '0'
169
+ requirements: []
170
+ rubygems_version: 3.0.3
171
+ signing_key:
172
+ specification_version: 4
173
+ summary: approve or reject first if status is Pending Developer Release.
174
+ test_files: []