diff --git a/RxCode.xcodeproj/project.pbxproj b/RxCode.xcodeproj/project.pbxproj index 41371e7..c031d70 100644 --- a/RxCode.xcodeproj/project.pbxproj +++ b/RxCode.xcodeproj/project.pbxproj @@ -1271,7 +1271,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 26.0; - MARKETING_VERSION = 1.2.5; + MARKETING_VERSION = 1.8.0; PRODUCT_BUNDLE_IDENTIFIER = com.rxlab.RxCode; PRODUCT_NAME = "$(TARGET_NAME)"; REGISTER_APP_GROUPS = YES; @@ -1305,7 +1305,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 26.0; - MARKETING_VERSION = 1.2.5; + MARKETING_VERSION = 1.8.0; PRODUCT_BUNDLE_IDENTIFIER = com.rxlab.RxCode; PRODUCT_NAME = "$(TARGET_NAME)"; REGISTER_APP_GROUPS = YES; diff --git a/scripts/ci/update-version.sh b/scripts/ci/update-version.sh index 1d8bb33..3cd687e 100755 --- a/scripts/ci/update-version.sh +++ b/scripts/ci/update-version.sh @@ -10,38 +10,63 @@ if [ -z "$VERSION" ]; then fi PROJECT_FILE="RxCode.xcodeproj/project.pbxproj" +BUNDLE_IDENTIFIER="com.rxlab.RxCode" if [ ! -f "$PROJECT_FILE" ]; then echo "Error: $PROJECT_FILE not found" exit 1 fi -echo "Updating MARKETING_VERSION to $VERSION in $PROJECT_FILE" +echo "Updating MARKETING_VERSION to $VERSION in $PROJECT_FILE for $BUNDLE_IDENTIFIER" # Create a temporary file TMP_FILE=$(mktemp) -# Use awk to update only the RxCode main target (matched by PRODUCT_BUNDLE_IDENTIFIER) -awk -v new_version="$VERSION" ' -/MARKETING_VERSION = / { - # Store the current line - marketing_line = $0 - # Read the next line - getline - # Check if this is the main app target (not Tests or UITests) - if ($0 ~ /PRODUCT_BUNDLE_IDENTIFIER = com\.idealapp\.RxCode;$/) { - # Update MARKETING_VERSION - gsub(/MARKETING_VERSION = [^;]+;/, "MARKETING_VERSION = " new_version ";", marketing_line) - print marketing_line - print - } else { - # Keep both lines unchanged - print marketing_line - print +# Update only build settings blocks for the macOS RxCode app target. +# Matching the whole block is safer than assuming MARKETING_VERSION is adjacent +# to PRODUCT_BUNDLE_IDENTIFIER in project.pbxproj. +awk -v new_version="$VERSION" -v bundle_id="$BUNDLE_IDENTIFIER" ' +BEGIN { + in_build_settings = 0 + block = "" + matched_bundle = 0 + updated_count = 0 +} + +/^[[:space:]]*buildSettings = \{[[:space:]]*$/ { + in_build_settings = 1 + block = $0 ORS + matched_bundle = 0 + next +} + +in_build_settings { + block = block $0 ORS + if (index($0, "PRODUCT_BUNDLE_IDENTIFIER = " bundle_id ";") > 0) { + matched_bundle = 1 + } + if ($0 ~ /^[[:space:]]*\};[[:space:]]*$/) { + if (matched_bundle) { + updated_count += gsub(/MARKETING_VERSION = [^;]+;/, "MARKETING_VERSION = " new_version ";", block) + } + printf "%s", block + in_build_settings = 0 + block = "" + matched_bundle = 0 } next } + { print } + +END { + if (in_build_settings) { + printf "%s", block + } + if (updated_count == 0) { + exit 1 + } +} ' "$PROJECT_FILE" > "$TMP_FILE" # Replace the original file