Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions RxCode.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
61 changes: 43 additions & 18 deletions scripts/ci/update-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Comment on lines +62 to +69
' "$PROJECT_FILE" > "$TMP_FILE"

# Replace the original file
Expand Down