fastlane-plugin-biggest_testflight_build_number 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +55 -0
- data/lib/fastlane/plugin/biggest_testflight_build_number/actions/biggest_testflight_build_number_action.rb +219 -0
- data/lib/fastlane/plugin/biggest_testflight_build_number/helper/biggest_testflight_build_number_helper.rb +16 -0
- data/lib/fastlane/plugin/biggest_testflight_build_number/version.rb +5 -0
- data/lib/fastlane/plugin/biggest_testflight_build_number.rb +16 -0
- metadata +49 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 57d63f2c2496dc1339c51fa270f9b211675642b0939684ddc637a9b93559516f
|
4
|
+
data.tar.gz: c6bd410dc9b16cd8be2ccf6222c145c429efc59d55c93ba300d65df591e4bfaa
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 98a71d85a8a535602b2bbb7ca1409969a976287d98a3c5d98054ff0bf04f5896b79329143f41cd17da946f9c6ddfe2888cb09b8f39aeefbb03d5055ddec2de01
|
7
|
+
data.tar.gz: f8dcef4512e63e79d976112b0b3d4893632f9daa34d85da434ae8ef6f0274518df3feebd9dfd87a6070ce850baebae0a1823680b10131b84d5bca23a18a7edc7
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2025 robotan0921
|
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,55 @@
|
|
1
|
+
# biggest_testflight_build_number plugin
|
2
|
+
|
3
|
+
[](https://rubygems.org/gems/fastlane-plugin-biggest_testflight_build_number)
|
4
|
+
|
5
|
+
## Getting Started
|
6
|
+
|
7
|
+
This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-biggest_testflight_build_number`, add it to your project by running:
|
8
|
+
|
9
|
+
```bash
|
10
|
+
fastlane add_plugin biggest_testflight_build_number
|
11
|
+
```
|
12
|
+
|
13
|
+
## About biggest_testflight_build_number
|
14
|
+
|
15
|
+
Fetches biggest build number from TestFlight
|
16
|
+
|
17
|
+
This plugin is inspired by [latest_testflight_build_number](https://docs.fastlane.tools/actions/latest_testflight_build_number/).
|
18
|
+
|
19
|
+
Its parameters and usage are the same as latest_testflight_build_number.
|
20
|
+
|
21
|
+
## Example
|
22
|
+
|
23
|
+
```
|
24
|
+
biggest_testflight_build_number(version: "1.3")
|
25
|
+
```
|
26
|
+
|
27
|
+
## Run tests for this plugin
|
28
|
+
|
29
|
+
To run both the tests, and code style validation, run
|
30
|
+
|
31
|
+
```
|
32
|
+
rake
|
33
|
+
```
|
34
|
+
|
35
|
+
To automatically fix many of the styling issues, use
|
36
|
+
|
37
|
+
```
|
38
|
+
rubocop -a
|
39
|
+
```
|
40
|
+
|
41
|
+
## Issues and Feedback
|
42
|
+
|
43
|
+
For any other issues and feedback about this plugin, please submit it to this repository.
|
44
|
+
|
45
|
+
## Troubleshooting
|
46
|
+
|
47
|
+
If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
|
48
|
+
|
49
|
+
## Using _fastlane_ Plugins
|
50
|
+
|
51
|
+
For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
|
52
|
+
|
53
|
+
## About _fastlane_
|
54
|
+
|
55
|
+
_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).
|
@@ -0,0 +1,219 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/biggest_testflight_build_number_helper'
|
3
|
+
|
4
|
+
require 'credentials_manager'
|
5
|
+
|
6
|
+
module Fastlane
|
7
|
+
module Actions
|
8
|
+
module SharedValues
|
9
|
+
BIGGEST_TESTFLIGHT_BUILD_NUMBER = :BIGGEST_TESTFLIGHT_BUILD_NUMBER
|
10
|
+
BIGGEST_TESTFLIGHT_VERSION = :BIGGEST_TESTFLIGHT_VERSION
|
11
|
+
end
|
12
|
+
|
13
|
+
class BiggestTestflightBuildNumberAction < Action
|
14
|
+
def self.run(params)
|
15
|
+
UI.message("The biggest_testflight_build_number plugin is working!")
|
16
|
+
build_v, build_nr = get_build_version_and_number(params)
|
17
|
+
|
18
|
+
Actions.lane_context[SharedValues::BIGGEST_TESTFLIGHT_BUILD_NUMBER] = build_nr
|
19
|
+
Actions.lane_context[SharedValues::BIGGEST_TESTFLIGHT_VERSION] = build_v
|
20
|
+
return build_nr
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.get_build_version_and_number(params)
|
24
|
+
require 'spaceship'
|
25
|
+
|
26
|
+
result = get_build_info(params)
|
27
|
+
build_nr = result.build_nr
|
28
|
+
|
29
|
+
# Convert build_nr to int (for legacy use) if no "." in string
|
30
|
+
if build_nr.kind_of?(String) && !build_nr.include?(".")
|
31
|
+
build_nr = build_nr.to_i
|
32
|
+
end
|
33
|
+
|
34
|
+
return result.build_v, build_nr
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.get_build_info(params)
|
38
|
+
# Prompts select team if multiple teams and none specified
|
39
|
+
if (api_token = Spaceship::ConnectAPI::Token.from(hash: params[:api_key], filepath: params[:api_key_path]))
|
40
|
+
UI.message("Creating authorization token for App Store Connect API")
|
41
|
+
Spaceship::ConnectAPI.token = api_token
|
42
|
+
elsif !Spaceship::ConnectAPI.token.nil?
|
43
|
+
UI.message("Using existing authorization token for App Store Connect API")
|
44
|
+
else
|
45
|
+
# Username is now optional since addition of App Store Connect API Key
|
46
|
+
# Force asking for username to prompt user if not already set
|
47
|
+
params.fetch(:username, force_ask: true)
|
48
|
+
|
49
|
+
UI.message("Login to App Store Connect (#{params[:username]})")
|
50
|
+
Spaceship::ConnectAPI.login(params[:username], use_portal: false, use_tunes: true, tunes_team_id: params[:team_id], team_name: params[:team_name])
|
51
|
+
UI.message("Login successful")
|
52
|
+
end
|
53
|
+
|
54
|
+
platform = Spaceship::ConnectAPI::Platform.map(params[:platform])
|
55
|
+
|
56
|
+
app = Spaceship::ConnectAPI::App.find(params[:app_identifier])
|
57
|
+
UI.user_error!("Could not find an app on App Store Connect with app_identifier: #{params[:app_identifier]}") unless app
|
58
|
+
if params[:live]
|
59
|
+
UI.message("Fetching the biggest build number for live-version")
|
60
|
+
live_version = app.get_live_app_store_version(platform: platform)
|
61
|
+
|
62
|
+
UI.user_error!("Could not find a live-version of #{params[:app_identifier]} on App Store Connect") unless live_version
|
63
|
+
build_nr = live_version.build.version
|
64
|
+
|
65
|
+
UI.message("Biggest upload for live-version #{live_version.version_string} is build: #{build_nr}")
|
66
|
+
|
67
|
+
return OpenStruct.new({ build_nr: build_nr, build_v: live_version.version_string })
|
68
|
+
else
|
69
|
+
version_number = params[:version]
|
70
|
+
platform = params[:platform]
|
71
|
+
|
72
|
+
# Create filter for get_builds with optional version number
|
73
|
+
filter = { app: app.id }
|
74
|
+
if version_number
|
75
|
+
filter["preReleaseVersion.version"] = version_number
|
76
|
+
version_number_message = "version #{version_number}"
|
77
|
+
else
|
78
|
+
version_number_message = "any version"
|
79
|
+
end
|
80
|
+
|
81
|
+
if platform
|
82
|
+
filter["preReleaseVersion.platform"] = Spaceship::ConnectAPI::Platform.map(platform)
|
83
|
+
platform_message = "#{platform} platform"
|
84
|
+
else
|
85
|
+
platform_message = "any platform"
|
86
|
+
end
|
87
|
+
|
88
|
+
UI.message("Fetching the biggest build number for #{version_number_message}")
|
89
|
+
|
90
|
+
# Get biggest build for optional version number and return build number if found
|
91
|
+
build = Spaceship::ConnectAPI.get_builds(filter: filter, sort: "-version", includes: "preReleaseVersion", limit: 1).first
|
92
|
+
if build
|
93
|
+
build_nr = build.version
|
94
|
+
UI.message("Biggest upload for version #{build.app_version} on #{platform_message} is build: #{build_nr}")
|
95
|
+
return OpenStruct.new({ build_nr: build_nr, build_v: build.app_version })
|
96
|
+
end
|
97
|
+
|
98
|
+
# Let user know that build couldn't be found
|
99
|
+
UI.important("Could not find a build for #{version_number_message} on #{platform_message} on App Store Connect")
|
100
|
+
|
101
|
+
if params[:initial_build_number].nil?
|
102
|
+
UI.user_error!("Could not find a build on App Store Connect - and 'initial_build_number' option is not set")
|
103
|
+
else
|
104
|
+
build_nr = params[:initial_build_number]
|
105
|
+
UI.message("Using initial build number of #{build_nr}")
|
106
|
+
return OpenStruct.new({ build_nr: build_nr, build_v: version_number })
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def self.description
|
112
|
+
"Fetches biggest build number from TestFlight"
|
113
|
+
end
|
114
|
+
|
115
|
+
def self.authors
|
116
|
+
["robotan0921"]
|
117
|
+
end
|
118
|
+
|
119
|
+
def self.return_value
|
120
|
+
# If your method provides a return value, you can describe here what it does
|
121
|
+
end
|
122
|
+
|
123
|
+
def self.details
|
124
|
+
# Optional:
|
125
|
+
[
|
126
|
+
"This plugin is inspired by [latest_testflight_build_number](https://docs.fastlane.tools/actions/latest_testflight_build_number/).",
|
127
|
+
"Its parameters and usage are the same as latest_testflight_build_number."
|
128
|
+
].join("\n")
|
129
|
+
end
|
130
|
+
|
131
|
+
def self.available_options
|
132
|
+
user = CredentialsManager::AppfileConfig.try_fetch_value(:itunes_connect_id)
|
133
|
+
user ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)
|
134
|
+
|
135
|
+
[
|
136
|
+
FastlaneCore::ConfigItem.new(key: :api_key_path,
|
137
|
+
env_names: ["APPSTORE_BUILD_NUMBER_API_KEY_PATH", "APP_STORE_CONNECT_API_KEY_PATH"],
|
138
|
+
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)",
|
139
|
+
optional: true,
|
140
|
+
conflicting_options: [:api_key],
|
141
|
+
verify_block: proc do |value|
|
142
|
+
UI.user_error!("Couldn't find API key JSON file at path '#{value}'") unless File.exist?(value)
|
143
|
+
end),
|
144
|
+
FastlaneCore::ConfigItem.new(key: :api_key,
|
145
|
+
env_names: ["APPSTORE_BUILD_NUMBER_API_KEY", "APP_STORE_CONNECT_API_KEY"],
|
146
|
+
description: "Your App Store Connect API Key information (https://docs.fastlane.tools/app-store-connect-api/#using-fastlane-api-key-hash-option)",
|
147
|
+
type: Hash,
|
148
|
+
optional: true,
|
149
|
+
sensitive: true,
|
150
|
+
conflicting_options: [:api_key_path]),
|
151
|
+
FastlaneCore::ConfigItem.new(key: :live,
|
152
|
+
short_option: "-l",
|
153
|
+
env_name: "CURRENT_BUILD_NUMBER_LIVE",
|
154
|
+
description: "Query the live version (ready-for-sale)",
|
155
|
+
optional: true,
|
156
|
+
type: Boolean,
|
157
|
+
default_value: false),
|
158
|
+
FastlaneCore::ConfigItem.new(key: :app_identifier,
|
159
|
+
short_option: "-a",
|
160
|
+
env_name: "FASTLANE_APP_IDENTIFIER",
|
161
|
+
description: "The bundle identifier of your app",
|
162
|
+
code_gen_sensitive: true,
|
163
|
+
default_value: CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier),
|
164
|
+
default_value_dynamic: true),
|
165
|
+
FastlaneCore::ConfigItem.new(key: :username,
|
166
|
+
short_option: "-u",
|
167
|
+
env_name: "ITUNESCONNECT_USER",
|
168
|
+
description: "Your Apple ID Username",
|
169
|
+
optional: true,
|
170
|
+
default_value: user,
|
171
|
+
default_value_dynamic: true),
|
172
|
+
FastlaneCore::ConfigItem.new(key: :version,
|
173
|
+
env_name: "LATEST_VERSION",
|
174
|
+
description: "The version number whose biggest build number we want",
|
175
|
+
optional: true),
|
176
|
+
FastlaneCore::ConfigItem.new(key: :platform,
|
177
|
+
short_option: "-j",
|
178
|
+
env_name: "APPSTORE_PLATFORM",
|
179
|
+
description: "The platform to use (optional)",
|
180
|
+
optional: true,
|
181
|
+
default_value: "ios",
|
182
|
+
verify_block: proc do |value|
|
183
|
+
UI.user_error!("The platform can only be ios, osx, xros or appletvos/tvos") unless %w(ios osx xros appletvos tvos).include?(value)
|
184
|
+
end),
|
185
|
+
FastlaneCore::ConfigItem.new(key: :initial_build_number,
|
186
|
+
env_name: "INITIAL_BUILD_NUMBER",
|
187
|
+
description: "sets the build number to given value if no build is in current train",
|
188
|
+
default_value: 1,
|
189
|
+
skip_type_validation: true), # allow Integer, String
|
190
|
+
FastlaneCore::ConfigItem.new(key: :team_id,
|
191
|
+
short_option: "-k",
|
192
|
+
env_name: "BIGGEST_TESTFLIGHT_BUILD_NUMBER_TEAM_ID",
|
193
|
+
description: "The ID of your App Store Connect team if you're in multiple teams",
|
194
|
+
optional: true,
|
195
|
+
skip_type_validation: true, # allow Integer, String
|
196
|
+
code_gen_sensitive: true,
|
197
|
+
default_value: CredentialsManager::AppfileConfig.try_fetch_value(:itc_team_id),
|
198
|
+
default_value_dynamic: true),
|
199
|
+
FastlaneCore::ConfigItem.new(key: :team_name,
|
200
|
+
short_option: "-e",
|
201
|
+
env_name: "BIGGEST_TESTFLIGHT_BUILD_NUMBER_TEAM_NAME",
|
202
|
+
description: "The name of your App Store Connect team if you're in multiple teams",
|
203
|
+
optional: true,
|
204
|
+
code_gen_sensitive: true,
|
205
|
+
default_value: CredentialsManager::AppfileConfig.try_fetch_value(:itc_team_name),
|
206
|
+
default_value_dynamic: true)
|
207
|
+
]
|
208
|
+
end
|
209
|
+
|
210
|
+
def self.is_supported?(platform)
|
211
|
+
# Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
|
212
|
+
# See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
|
213
|
+
#
|
214
|
+
# [:ios, :mac, :android].include?(platform)
|
215
|
+
true
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|
219
|
+
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 BiggestTestflightBuildNumberHelper
|
8
|
+
# class methods that you define here become available in your action
|
9
|
+
# as `Helper::BiggestTestflightBuildNumberHelper.your_method`
|
10
|
+
#
|
11
|
+
def self.show_message
|
12
|
+
UI.message("Hello from the biggest_testflight_build_number plugin helper!")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'fastlane/plugin/biggest_testflight_build_number/version'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module BiggestTestflightBuildNumber
|
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::BiggestTestflightBuildNumber.all_classes.each do |current|
|
15
|
+
require current
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fastlane-plugin-biggest_testflight_build_number
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- robotan0921
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2025-03-06 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email: sukeroku.gg@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- LICENSE
|
20
|
+
- README.md
|
21
|
+
- lib/fastlane/plugin/biggest_testflight_build_number.rb
|
22
|
+
- lib/fastlane/plugin/biggest_testflight_build_number/actions/biggest_testflight_build_number_action.rb
|
23
|
+
- lib/fastlane/plugin/biggest_testflight_build_number/helper/biggest_testflight_build_number_helper.rb
|
24
|
+
- lib/fastlane/plugin/biggest_testflight_build_number/version.rb
|
25
|
+
homepage: https://github.com/robotan0921/fastlane-plugin-biggest_testflight_build_number
|
26
|
+
licenses:
|
27
|
+
- MIT
|
28
|
+
metadata:
|
29
|
+
rubygems_mfa_required: 'true'
|
30
|
+
post_install_message:
|
31
|
+
rdoc_options: []
|
32
|
+
require_paths:
|
33
|
+
- lib
|
34
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ">="
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '2.6'
|
39
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
requirements: []
|
45
|
+
rubygems_version: 3.5.22
|
46
|
+
signing_key:
|
47
|
+
specification_version: 4
|
48
|
+
summary: Fetches biggest build number from TestFlight
|
49
|
+
test_files: []
|