Skip to content

Commit fda34f5

Browse files
committed
Update Fastfile
1 parent be3e149 commit fda34f5

1 file changed

Lines changed: 3 additions & 77 deletions

File tree

ios/fastlane/Fastfile

Lines changed: 3 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -4,73 +4,10 @@ require 'yaml'
44

55
platform :ios do
66

7-
require 'spaceship'
8-
9-
lane :get_max_build_number do |options|
10-
11-
version = options[:version]
12-
bundle_id = options[:bundle_id]
13-
14-
app = Spaceship::ConnectAPI::App.find(bundle_id)
15-
16-
UI.message("📦 Fetching builds for version #{version}...")
17-
18-
builds = Spaceship::ConnectAPI::Build.all(
19-
app_id: app.id,
20-
sort: "-uploadedDate", # optional
21-
limit: 200
22-
)
23-
24-
matching_builds = builds.select { |b| b.version == version }
25-
max_build = matching_builds.map { |b| b.build_number.to_i }.max || 0
26-
27-
UI.success("🚀 Max build number for version #{version} is #{max_build}")
28-
return max_build
29-
end
30-
31-
desc "🔧 Build and upload to TestFlight (local use only"
32-
lane :testflight_release do
33-
34-
# Load the custom environment file
35-
Dotenv.load('.env.testflight_release')
36-
37-
app_store_connect_api_key(
38-
key_id: ENV["APP_STORE_KEY_ID"],
39-
issuer_id: ENV["APP_STORE_ISSUER_ID"],
40-
key_filepath: ENV["APP_STORE_KEY_PATH"]
41-
)
42-
43-
sh "flutter clean"
44-
sh "flutter pub get"
45-
sh "pod install"
46-
47-
increment_build_number(
48-
build_number: latest_testflight_build_number + 1
49-
)
50-
51-
build_app(
52-
workspace: "Runner.xcworkspace",
53-
scheme: "Runner",
54-
configuration: "Release",
55-
export_method: "app-store",
56-
clean: true,
57-
silent: false,
58-
export_options: {
59-
signingStyle: "automatic",
60-
manageAppVersionAndBuildNumber: true
61-
}
62-
)
63-
64-
#upload_to_testflight(
65-
# skip_waiting_for_build_processing: true,
66-
#distribute_external: false
67-
#)
68-
69-
end
70-
717
desc "🤖 CI: Build and upload silently to TestFlight"
728
lane :ci_testflight_release do
739
require 'xcodeproj'
10+
require 'spaceship'
7411

7512
create_keychain(
7613
name: "ci_temp_keychain",
@@ -127,11 +64,9 @@ platform :ios do
12764
UI.user_error!("❌ Could not find app with bundle ID: #{bundle_id}")
12865
end
12966

130-
#builds = Spaceship::ConnectAPI::Build.all(app_id: app.id)
131-
13267
builds = Spaceship::ConnectAPI::Build.all(
13368
app_id: app.id,
134-
sort: "-uploadedDate", # optional
69+
sort: "-uploadedDate",
13570
limit: 200
13671
)
13772

@@ -142,13 +77,6 @@ platform :ios do
14277

14378
UI.message("🔍 Version being checked: #{version}")
14479

145-
# Log build versions for comparison
146-
builds.each do |b|
147-
puts b.to_yaml
148-
UI.message("Version: #{b.pre_release_version&.version}")
149-
UI.message("Build number: #{b.version}")
150-
end
151-
15280
matching_builds = builds.select do |b|
15381
b.pre_release_version&.version == version
15482
end
@@ -165,14 +93,12 @@ platform :ios do
16593

16694
UI.message("🔢 Next build number: #{next_build}")
16795

168-
# Update Info.plist
16996
increment_build_number(build_number: next_build)
17097

17198
# Update pubspec.yaml to match
17299
pubspec["version"] = "#{version}+#{next_build}"
173100
File.write(pubspec_path, pubspec.to_yaml)
174101

175-
# Build the app using build_app (this will use the incremented build number)
176102
build_app(
177103
workspace: "Runner.xcworkspace",
178104
scheme: "Runner",
@@ -188,7 +114,7 @@ platform :ios do
188114
distribute_external: false
189115
)
190116

191-
# Clean up keychain (optional but good practice)
117+
# Clean up keychain
192118
delete_keychain(
193119
name: "ci_temp_keychain"
194120
)

0 commit comments

Comments
 (0)