Skip to content

Commit 5781131

Browse files
committed
chore: pre-release auto commit
1 parent adb6caa commit 5781131

File tree

3 files changed

+78
-47
lines changed

3 files changed

+78
-47
lines changed

MirrorSmokerStopper.xcodeproj/project.pbxproj

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@
690690
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
691691
CODE_SIGN_ENTITLEMENTS = HomeWidgetExtension.entitlements;
692692
CODE_SIGN_STYLE = Automatic;
693-
CURRENT_PROJECT_VERSION = 3;
693+
CURRENT_PROJECT_VERSION = 4;
694694
DEVELOPMENT_TEAM = 93T3LG4NPG;
695695
GENERATE_INFOPLIST_FILE = YES;
696696
INFOPLIST_FILE = HomeWidget/Info.plist;
@@ -720,7 +720,7 @@
720720
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
721721
CODE_SIGN_ENTITLEMENTS = HomeWidgetExtension.entitlements;
722722
CODE_SIGN_STYLE = Automatic;
723-
CURRENT_PROJECT_VERSION = 3;
723+
CURRENT_PROJECT_VERSION = 4;
724724
DEVELOPMENT_TEAM = 93T3LG4NPG;
725725
GENERATE_INFOPLIST_FILE = YES;
726726
INFOPLIST_FILE = HomeWidget/Info.plist;
@@ -873,7 +873,7 @@
873873
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
874874
CODE_SIGN_ENTITLEMENTS = "MirrorSmokerStopper Watch App/MirrorSmokerStopper Watch App.entitlements";
875875
CODE_SIGN_STYLE = Automatic;
876-
CURRENT_PROJECT_VERSION = 3;
876+
CURRENT_PROJECT_VERSION = 4;
877877
DEVELOPMENT_TEAM = 93T3LG4NPG;
878878
ENABLE_PREVIEWS = YES;
879879
GENERATE_INFOPLIST_FILE = YES;
@@ -904,7 +904,7 @@
904904
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
905905
CODE_SIGN_ENTITLEMENTS = "MirrorSmokerStopper Watch App/MirrorSmokerStopper Watch App.entitlements";
906906
CODE_SIGN_STYLE = Automatic;
907-
CURRENT_PROJECT_VERSION = 3;
907+
CURRENT_PROJECT_VERSION = 4;
908908
DEVELOPMENT_TEAM = 93T3LG4NPG;
909909
ENABLE_PREVIEWS = YES;
910910
GENERATE_INFOPLIST_FILE = YES;
@@ -936,7 +936,7 @@
936936
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
937937
CODE_SIGN_ENTITLEMENTS = MirrorSmokerStopper/MirrorSmokerStopper.entitlements;
938938
CODE_SIGN_STYLE = Automatic;
939-
CURRENT_PROJECT_VERSION = 3;
939+
CURRENT_PROJECT_VERSION = 4;
940940
DEVELOPMENT_TEAM = 93T3LG4NPG;
941941
ENABLE_PREVIEWS = YES;
942942
GENERATE_INFOPLIST_FILE = YES;
@@ -977,7 +977,7 @@
977977
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
978978
CODE_SIGN_ENTITLEMENTS = MirrorSmokerStopper/MirrorSmokerStopper.entitlements;
979979
CODE_SIGN_STYLE = Automatic;
980-
CURRENT_PROJECT_VERSION = 3;
980+
CURRENT_PROJECT_VERSION = 4;
981981
DEVELOPMENT_TEAM = 93T3LG4NPG;
982982
ENABLE_PREVIEWS = YES;
983983
GENERATE_INFOPLIST_FILE = YES;
@@ -1017,7 +1017,7 @@
10171017
buildSettings = {
10181018
BUNDLE_LOADER = "$(TEST_HOST)";
10191019
CODE_SIGN_STYLE = Automatic;
1020-
CURRENT_PROJECT_VERSION = 3;
1020+
CURRENT_PROJECT_VERSION = 4;
10211021
DEVELOPMENT_TEAM = 93T3LG4NPG;
10221022
GENERATE_INFOPLIST_FILE = YES;
10231023
IPHONEOS_DEPLOYMENT_TARGET = 18.5;
@@ -1037,7 +1037,7 @@
10371037
buildSettings = {
10381038
BUNDLE_LOADER = "$(TEST_HOST)";
10391039
CODE_SIGN_STYLE = Automatic;
1040-
CURRENT_PROJECT_VERSION = 3;
1040+
CURRENT_PROJECT_VERSION = 4;
10411041
DEVELOPMENT_TEAM = 93T3LG4NPG;
10421042
GENERATE_INFOPLIST_FILE = YES;
10431043
IPHONEOS_DEPLOYMENT_TARGET = 18.5;
@@ -1057,7 +1057,7 @@
10571057
isa = XCBuildConfiguration;
10581058
buildSettings = {
10591059
CODE_SIGN_STYLE = Automatic;
1060-
CURRENT_PROJECT_VERSION = 3;
1060+
CURRENT_PROJECT_VERSION = 4;
10611061
DEVELOPMENT_TEAM = 93T3LG4NPG;
10621062
GENERATE_INFOPLIST_FILE = YES;
10631063
IPHONEOS_DEPLOYMENT_TARGET = 18.5;
@@ -1076,7 +1076,7 @@
10761076
isa = XCBuildConfiguration;
10771077
buildSettings = {
10781078
CODE_SIGN_STYLE = Automatic;
1079-
CURRENT_PROJECT_VERSION = 3;
1079+
CURRENT_PROJECT_VERSION = 4;
10801080
DEVELOPMENT_TEAM = 93T3LG4NPG;
10811081
GENERATE_INFOPLIST_FILE = YES;
10821082
IPHONEOS_DEPLOYMENT_TARGET = 18.5;
@@ -1097,7 +1097,7 @@
10971097
buildSettings = {
10981098
BUNDLE_LOADER = "$(TEST_HOST)";
10991099
CODE_SIGN_STYLE = Automatic;
1100-
CURRENT_PROJECT_VERSION = 3;
1100+
CURRENT_PROJECT_VERSION = 4;
11011101
DEVELOPMENT_TEAM = 93T3LG4NPG;
11021102
GENERATE_INFOPLIST_FILE = YES;
11031103
MARKETING_VERSION = 1.0;
@@ -1117,7 +1117,7 @@
11171117
buildSettings = {
11181118
BUNDLE_LOADER = "$(TEST_HOST)";
11191119
CODE_SIGN_STYLE = Automatic;
1120-
CURRENT_PROJECT_VERSION = 3;
1120+
CURRENT_PROJECT_VERSION = 4;
11211121
DEVELOPMENT_TEAM = 93T3LG4NPG;
11221122
GENERATE_INFOPLIST_FILE = YES;
11231123
MARKETING_VERSION = 1.0;
@@ -1137,7 +1137,7 @@
11371137
isa = XCBuildConfiguration;
11381138
buildSettings = {
11391139
CODE_SIGN_STYLE = Automatic;
1140-
CURRENT_PROJECT_VERSION = 3;
1140+
CURRENT_PROJECT_VERSION = 4;
11411141
DEVELOPMENT_TEAM = 93T3LG4NPG;
11421142
GENERATE_INFOPLIST_FILE = YES;
11431143
MARKETING_VERSION = 1.0;
@@ -1156,7 +1156,7 @@
11561156
isa = XCBuildConfiguration;
11571157
buildSettings = {
11581158
CODE_SIGN_STYLE = Automatic;
1159-
CURRENT_PROJECT_VERSION = 3;
1159+
CURRENT_PROJECT_VERSION = 4;
11601160
DEVELOPMENT_TEAM = 93T3LG4NPG;
11611161
GENERATE_INFOPLIST_FILE = YES;
11621162
MARKETING_VERSION = 1.0;

MirrorSmokerStopper/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<key>CFBundleShortVersionString</key>
66
<string>1.0.1</string>
77
<key>CFBundleVersion</key>
8-
<string>3</string>
8+
<string>4</string>
99
<key>UIApplicationSceneManifest</key>
1010
<dict>
1111
<key>UIApplicationSupportsMultipleScenes</key>

fastlane/Fastfile

Lines changed: 63 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -430,49 +430,80 @@ platform :ios do
430430
# 1. Signing: usa direttamente configurazione Xcode (Automatic Signing)
431431
UI.message('[release] Using Xcode Automatic Signing')
432432

433-
# 2. Versioning: se NEW_VERSION impostato lo usa, altrimenti incrementa patch
434-
# MARKETING_VERSION gestita da Xcode build settings (GENERATE_INFOPLIST_FILE=YES)
433+
# 2. Versioning manuale (niente agvtool / increment_* Fastlane)
434+
plist_path = "MirrorSmokerStopper/Info.plist"
435+
# Leggi versione corrente dal plist (fallback 1.0.0 se mancante)
436+
current_v = ` /usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" "#{plist_path}" 2>/dev/null`.strip
437+
current_v = "1.0.0" if current_v.empty?
435438
if ENV['NEW_VERSION'] && !ENV['NEW_VERSION'].empty?
436-
increment_version_number(
437-
version_number: ENV['NEW_VERSION'],
438-
xcodeproj: "MirrorSmokerStopper.xcodeproj"
439-
)
439+
new_version = ENV['NEW_VERSION']
440440
else
441-
# Legge marketing version attuale; se manca, setta 1.0.0
442-
current_v = '1.0.0'
443441
bump = (ENV['BUMP_TYPE'] || 'patch').downcase
444-
segments = current_v.split('.')
445-
segments << '0' while segments.length < 3
442+
parts = current_v.split('.')
443+
parts << '0' while parts.length < 3
446444
case bump
447445
when 'patch'
448-
segments[2] = (segments[2].to_i + 1).to_s
446+
parts[2] = (parts[2].to_i + 1).to_s
449447
when 'minor'
450-
segments[1] = (segments[1].to_i + 1).to_s
451-
segments[2] = '0'
448+
parts[1] = (parts[1].to_i + 1).to_s
449+
parts[2] = '0'
452450
when 'major'
453-
segments[0] = (segments[0].to_i + 1).to_s
454-
segments[1] = '0'
455-
segments[2] = '0'
451+
parts[0] = (parts[0].to_i + 1).to_s
452+
parts[1] = '0'
453+
parts[2] = '0'
456454
else
457455
UI.user_error!("BUMP_TYPE deve essere patch|minor|major")
458456
end
459-
new_marketing = segments.join('.')
460-
increment_version_number(version_number: new_marketing, xcodeproj: "MirrorSmokerStopper.xcodeproj")
457+
new_version = parts.join('.')
458+
end
459+
UI.message("[release] Marketing version: #{current_v} -> #{new_version}")
460+
461+
# Scrivi nuova marketing version nel plist (add se non esiste)
462+
sh(%Q{/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString #{new_version}" "#{plist_path}" 2>/dev/null || /usr/libexec/PlistBuddy -c "Add :CFBundleShortVersionString string #{new_version}" "#{plist_path}"})
463+
464+
# Aggiorna anche project.pbxproj (MARKETING_VERSION) per coerenza con Xcode build settings
465+
pbxproj = "MirrorSmokerStopper.xcodeproj/project.pbxproj"
466+
if File.exist?(pbxproj)
467+
# Usa Ruby inline edit evitando duplicare se già uguale
468+
ruby_cmd = <<~RUBY
469+
path = '#{pbxproj}'
470+
txt = File.read(path)
471+
new_txt = txt.gsub(/MARKETING_VERSION = [0-9.]+;/, "MARKETING_VERSION = #{new_version};")
472+
if txt != new_txt
473+
File.open(path, 'w'){|f| f.write(new_txt)}
474+
end
475+
RUBY
476+
sh("ruby -e \"#{ruby_cmd.gsub("\n", ';')}\"")
461477
end
462478

463-
# 3. Increment build number sempre (per evitare duplicati su App Store Connect)
479+
# 3. Build number manuale
480+
current_build = ` /usr/libexec/PlistBuddy -c "Print :CFBundleVersion" "#{plist_path}" 2>/dev/null`.strip
464481
if ENV['USE_TIMESTAMP_BUILD'] == '1'
465-
ts = Time.now.strftime('%Y%m%d%H%M')
466-
increment_build_number(
467-
build_number: ts,
468-
xcodeproj: "MirrorSmokerStopper.xcodeproj"
469-
)
482+
new_build = Time.now.strftime('%Y%m%d%H%M')
470483
else
471-
increment_build_number(
472-
xcodeproj: "MirrorSmokerStopper.xcodeproj"
473-
)
484+
numeric = current_build.to_i.to_s == current_build
485+
new_build = numeric ? (current_build.to_i + 1).to_s : '1'
486+
end
487+
UI.message("[release] Build number: #{current_build.empty? ? '(nil)' : current_build} -> #{new_build}")
488+
sh(%Q{/usr/libexec/PlistBuddy -c "Set :CFBundleVersion #{new_build}" "#{plist_path}" 2>/dev/null || /usr/libexec/PlistBuddy -c "Add :CFBundleVersion string #{new_build}" "#{plist_path}"})
489+
490+
# Aggiorna CURRENT_PROJECT_VERSION nel project.pbxproj
491+
if File.exist?(pbxproj)
492+
ruby_cmd2 = <<~RUBY
493+
path = '#{pbxproj}'
494+
txt = File.read(path)
495+
new_txt = txt.gsub(/CURRENT_PROJECT_VERSION = [0-9A-Za-z_.-]+;/, "CURRENT_PROJECT_VERSION = #{new_build};")
496+
if txt != new_txt
497+
File.open(path, 'w'){|f| f.write(new_txt)}
498+
end
499+
RUBY
500+
sh("ruby -e \"#{ruby_cmd2.gsub("\n", ';')}\"")
474501
end
475502

503+
# Esponi variabili in ambiente lane
504+
ENV['EFFECTIVE_MARKETING_VERSION'] = new_version
505+
ENV['EFFECTIVE_BUILD_NUMBER'] = new_build
506+
476507

477508
# 4. Test rapidi (opzionale: si può abilitare var FASTLANE_SKIP_TESTS)
478509
unless ENV['FASTLANE_SKIP_TESTS'] == '1'
@@ -505,7 +536,7 @@ platform :ios do
505536
clean: true,
506537
export_method: "app-store",
507538
output_directory: "build",
508-
output_name: "MirrorSmokerStopper_#{new_version}.ipa",
539+
output_name: "MirrorSmokerStopper_#{ENV['EFFECTIVE_MARKETING_VERSION']}.ipa",
509540
skip_codesigning: false
510541
)
511542

@@ -528,7 +559,7 @@ platform :ios do
528559
unless ENV['DRY_RUN'] == '1'
529560
deliver(
530561
force: true,
531-
ipa: "build/MirrorSmokerStopper_#{new_version}.ipa",
562+
ipa: "build/MirrorSmokerStopper_#{ENV['EFFECTIVE_MARKETING_VERSION']}.ipa",
532563
screenshots_path: "./fastlane/screenshots",
533564
submit_for_review: true,
534565
automatic_release: false,
@@ -541,13 +572,13 @@ platform :ios do
541572
end
542573

543574
# 10. Commit version + build bump + release info json
544-
sh("git add -A && git commit -m 'release: #{new_version}' || true")
575+
sh("git add -A && git commit -m 'release: #{ENV['EFFECTIVE_MARKETING_VERSION']}' || true")
545576

546577
# 11. Tag + push
547-
add_git_tag(tag: "v#{new_version}") unless ENV['DRY_RUN'] == '1'
578+
add_git_tag(tag: "v#{ENV['EFFECTIVE_MARKETING_VERSION']}") unless ENV['DRY_RUN'] == '1'
548579
push_to_git_remote unless ENV['DRY_RUN'] == '1'
549580

550-
UI.success("Release #{new_version} inviata per review su App Store Connect.")
581+
UI.success("Release #{ENV['EFFECTIVE_MARKETING_VERSION']} (#{ENV['EFFECTIVE_BUILD_NUMBER']}) inviata per review su App Store Connect.")
551582
end
552583

553584
# Clean up old screenshots and builds

0 commit comments

Comments
 (0)