Skip to content

Commit 2eff96d

Browse files
committed
fix: handle version management without agvtool for xcconfig-based versioning
1 parent 314e855 commit 2eff96d

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

fastlane/Fastfile

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,23 @@ platform :ios do
5454
api_key = get_api_key
5555

5656
# Get the latest TestFlight build number and increment
57-
current_build_number = get_build_number(xcodeproj: "V2er.xcodeproj").to_i
57+
# Read current build number from xcconfig
58+
xcconfig_path = "V2er/Config/Version.xcconfig"
59+
xcconfig_content = File.read(xcconfig_path)
60+
current_build_number = xcconfig_content.match(/CURRENT_PROJECT_VERSION = (\d+)/)[1].to_i
61+
5862
latest_testflight = latest_testflight_build_number(api_key: api_key)
5963

6064
# Only increment if needed
6165
if latest_testflight >= current_build_number
62-
increment_build_number(
63-
build_number: latest_testflight + 1,
64-
xcodeproj: "V2er.xcodeproj"
66+
new_build_number = latest_testflight + 1
67+
# Update the xcconfig file
68+
new_content = xcconfig_content.gsub(
69+
/CURRENT_PROJECT_VERSION = \d+/,
70+
"CURRENT_PROJECT_VERSION = #{new_build_number}"
6571
)
72+
File.write(xcconfig_path, new_content)
73+
UI.message("Updated build number to #{new_build_number}")
6674
end
6775

6876
# Ensure proper code signing

0 commit comments

Comments
 (0)