@@ -18,3 +18,40 @@ 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+ # We'll look for the last line that matches the table entry pattern (starts with | and contains version numbers)
41+ LAST_TABLE_LINE=$( grep -n " ^| [0-9]" $README_FILE | tail -1 | cut -d: -f1)
42+
43+ if [ -z " $LAST_TABLE_LINE " ]; then
44+ echo " Could not find the last entry in the compatibility table"
45+ exit 1
46+ fi
47+
48+ TEMP_FILE=$( mktemp)
49+
50+ head -n $LAST_TABLE_LINE $README_FILE > $TEMP_FILE
51+ echo " | $NEW_VERSION | $PODSPEC_VERSION |" >> $TEMP_FILE
52+ tail -n +$(( LAST_TABLE_LINE + 1 )) $README_FILE >> $TEMP_FILE
53+
54+ # Replace the original file with the modified content
55+ mv $TEMP_FILE $README_FILE
56+
57+ echo " Added new compatibility table entry: | $NEW_VERSION | $PODSPEC_VERSION |"
0 commit comments