Настройка Fastlane: автоинкремент версий, идентификатор приложения и экспортный compliance

This commit is contained in:
2026-03-09 19:34:29 +05:00
parent d6d50eb214
commit 4dd46b1cf6
6 changed files with 73 additions and 37 deletions

2
.gitignore vendored
View File

@@ -32,4 +32,4 @@ fastlane/test_output
# macOS # macOS
.DS_Store .DS_Store
*.swp *.swp
*~ *~

View File

@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict/> <dict>
<key>ITSAppUsesNonExemptEncryption</key>
<true/>
</dict>
</plist> </plist>

View File

@@ -264,7 +264,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5; CURRENT_PROJECT_VERSION = 7;
DEVELOPMENT_TEAM = QN8Z263QGX; DEVELOPMENT_TEAM = QN8Z263QGX;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
@@ -280,7 +280,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.3; MARKETING_VERSION = 1.0.6;
PRODUCT_BUNDLE_IDENTIFIER = com.rosetta.dev; PRODUCT_BUNDLE_IDENTIFIER = com.rosetta.dev;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
@@ -302,7 +302,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5; CURRENT_PROJECT_VERSION = 7;
DEVELOPMENT_TEAM = QN8Z263QGX; DEVELOPMENT_TEAM = QN8Z263QGX;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
@@ -318,7 +318,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.3; MARKETING_VERSION = 1.0.6;
PRODUCT_BUNDLE_IDENTIFIER = com.rosetta.dev; PRODUCT_BUNDLE_IDENTIFIER = com.rosetta.dev;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";

View File

@@ -1,4 +1,4 @@
app_identifier("com.rosetta.messenger") app_identifier("com.rosetta.dev")
apple_id("melissa.james2000@aol.com") apple_id("melissa.james2000@aol.com")
# team_id и itc_team_id не нужны для индивидуального аккаунта — Fastlane определит автоматически # team_id и itc_team_id не нужны для индивидуального аккаунта — Fastlane определит автоматически

View File

@@ -2,39 +2,76 @@ default_platform(:ios)
platform :ios do platform :ios do
# ─── Хелпер: читает MARKETING_VERSION из pbxproj ───
def current_marketing_version
pbxproj = File.read("../Rosetta.xcodeproj/project.pbxproj")
pbxproj.match(/MARKETING_VERSION = ([\d.]+);/)[1]
end
# ─── Хелпер: читает CURRENT_PROJECT_VERSION из pbxproj ───
def current_build_number
pbxproj = File.read("../Rosetta.xcodeproj/project.pbxproj")
pbxproj.match(/CURRENT_PROJECT_VERSION = (\d+);/)[1].to_i
end
# ─── Хелпер: инкремент patch версии (1.0.4 → 1.0.5) ───
def bump_patch(version)
parts = version.split(".").map(&:to_i)
parts[2] = (parts[2] || 0) + 1
parts.join(".")
end
# ─── Хелпер: обновляет MARKETING_VERSION в pbxproj ───
def set_marketing_version(new_version)
path = "../Rosetta.xcodeproj/project.pbxproj"
content = File.read(path)
content.gsub!(/MARKETING_VERSION = [\d.]+;/, "MARKETING_VERSION = #{new_version};")
File.write(path, content)
UI.success("MARKETING_VERSION → #{new_version}")
end
# ─── Хелпер: обновляет CURRENT_PROJECT_VERSION в pbxproj ───
def set_build_number(new_build)
path = "../Rosetta.xcodeproj/project.pbxproj"
content = File.read(path)
content.gsub!(/CURRENT_PROJECT_VERSION = \d+;/, "CURRENT_PROJECT_VERSION = #{new_build};")
File.write(path, content)
UI.success("CURRENT_PROJECT_VERSION → #{new_build}")
end
# ─── Автоинкремент build number ─── # ─── Автоинкремент build number ───
desc "Increment build number (CURRENT_PROJECT_VERSION)" desc "Increment build number (CURRENT_PROJECT_VERSION)"
lane :bump_build do lane :bump_build do
increment_build_number( new_build = current_build_number + 1
xcodeproj: "Rosetta.xcodeproj" set_build_number(new_build)
)
end end
# ─── Инкремент версии (patch/minor/major) ─── # ─── Инкремент версии (patch) ───
desc "Increment version number. Usage: fastlane bump_version type:patch" desc "Increment version number (patch)"
lane :bump_version do |options| lane :bump_version do
type = options[:type] || "patch" new_version = bump_patch(current_marketing_version)
increment_version_number( set_marketing_version(new_version)
xcodeproj: "Rosetta.xcodeproj",
bump_type: type
)
end end
# ─── Билд для TestFlight ─── # ─── Билд для TestFlight ───
desc "Build and upload to TestFlight" desc "Build and upload to TestFlight"
lane :beta do lane :beta do
increment_build_number(
xcodeproj: "Rosetta.xcodeproj"
)
build_app( build_app(
project: "Rosetta.xcodeproj", project: "Rosetta.xcodeproj",
scheme: "Rosetta", scheme: "Rosetta",
configuration: "Release", configuration: "Release",
export_method: "app-store", export_method: "app-store",
clean: true clean: true,
xcargs: "SWIFT_OPTIMIZATION_LEVEL='-Onone'"
) )
# Инкремент только после успешной сборки
new_version = bump_patch(current_marketing_version)
set_marketing_version(new_version)
new_build = current_build_number + 1
set_build_number(new_build)
upload_to_testflight( upload_to_testflight(
skip_waiting_for_build_processing: true skip_waiting_for_build_processing: true
) )
@@ -42,26 +79,22 @@ platform :ios do
# ─── Release в App Store ─── # ─── Release в App Store ───
desc "Build and upload to App Store" desc "Build and upload to App Store"
lane :release do |options| lane :release do
type = options[:type] || "patch"
increment_version_number(
xcodeproj: "Rosetta.xcodeproj",
bump_type: type
)
increment_build_number(
xcodeproj: "Rosetta.xcodeproj"
)
build_app( build_app(
project: "Rosetta.xcodeproj", project: "Rosetta.xcodeproj",
scheme: "Rosetta", scheme: "Rosetta",
configuration: "Release", configuration: "Release",
export_method: "app-store", export_method: "app-store",
clean: true clean: true,
xcargs: "SWIFT_OPTIMIZATION_LEVEL='-Onone'"
) )
new_version = bump_patch(current_marketing_version)
set_marketing_version(new_version)
new_build = current_build_number + 1
set_build_number(new_build)
upload_to_app_store( upload_to_app_store(
force: true, force: true,
skip_screenshots: true skip_screenshots: true

View File

@@ -29,7 +29,7 @@ Increment build number (CURRENT_PROJECT_VERSION)
[bundle exec] fastlane ios bump_version [bundle exec] fastlane ios bump_version
``` ```
Increment version number. Usage: fastlane bump_version type:patch Increment version number (patch)
### ios beta ### ios beta