@@ -18,3 +18,48 @@ PLUGIN_GRADLE_FILEPATH="sentry-kotlin-multiplatform-gradle-plugin/gradle.propert
1818VERSION_NAME_PATTERN=" versionName"
1919perl -pi -e " s/$VERSION_NAME_PATTERN =.*$/$VERSION_NAME_PATTERN =$NEW_VERSION /g" $GRADLE_FILEPATH
2020perl -pi -e " s/$VERSION_NAME_PATTERN =.*$/$VERSION_NAME_PATTERN =$NEW_VERSION /g" $PLUGIN_GRADLE_FILEPATH
21+
22+ PODSPEC_FILEPATH=' sentry-kotlin-multiplatform/sentry_kotlin_multiplatform.podspec'
23+ PODSPEC_CONTENT=$( cat $PODSPEC_FILEPATH )
24+
25+ PODSPEC_REGEX=" ('Sentry', *)'([0-9\.]+)'"
26+
27+ if ! [[ $PODSPEC_CONTENT =~ $PODSPEC_REGEX ]]; then
28+ echo " Failed to find the Cocoa version in $PODSPEC_FILEPATH "
29+ exit 1
30+ fi
31+
32+ PODSPEC_WHOLE_MATCH=${BASH_REMATCH[0]}
33+ PODSPEC_VAR_NAME=${BASH_REMATCH[1]}
34+ PODSPEC_VERSION=${BASH_REMATCH[2]}
35+
36+ # create a new table entry in readme with NEW_VERSION and PODSPEC_VERSION in the compatibility table
37+ # Find the line number of the last entry in the compatibility table and insert the new entry after it
38+ README_FILE=" README.md"
39+
40+ # Check if an entry with the same KMP version and Cocoa version already exists
41+ EXISTING_ENTRY=$( grep " | $NEW_VERSION " $README_FILE 2> /dev/null | grep " $PODSPEC_VERSION " 2> /dev/null || true)
42+
43+ if [ -n " $EXISTING_ENTRY " ]; then
44+ echo " Found same KMP and Cocoaversion in the compatibility table. Skipping addition to avoid duplicate."
45+ exit 0
46+ fi
47+
48+ # We'll look for the last line that matches the table entry pattern (starts with | and contains version numbers)
49+ LAST_TABLE_LINE=$( grep -n " ^| [0-9]" $README_FILE | tail -1 | cut -d: -f1)
50+
51+ if [ -z " $LAST_TABLE_LINE " ]; then
52+ echo " Could not find the last entry in the compatibility table"
53+ exit 1
54+ fi
55+
56+ TEMP_FILE=$( mktemp)
57+
58+ head -n $LAST_TABLE_LINE $README_FILE > $TEMP_FILE
59+ echo " | $NEW_VERSION | $PODSPEC_VERSION |" >> $TEMP_FILE
60+ tail -n +$(( LAST_TABLE_LINE + 1 )) $README_FILE >> $TEMP_FILE
61+
62+ # Replace the original file with the modified content
63+ mv $TEMP_FILE $README_FILE
64+
65+ echo " Added new compatibility table entry: | $NEW_VERSION | $PODSPEC_VERSION |"
0 commit comments