5858 export PATH=~/.npm-global/bin:$PATH
5959 npm install cordova@$CORDOVA_VERSION -g
6060
61- - name : Create Cordova app, install plugin then build app
61+ - name : Create Cordova app, install plugin
6262 env :
6363 CORDOVA_IOS_VERSION : " latest"
6464 run : |
@@ -72,17 +72,21 @@ jobs:
7272 run : |
7373 npm config set prefix '~/.npm-global'
7474 export PATH=~/.npm-global/bin:$PATH
75- cd ..; cd myApp;
76- # Check if iOS platform section exists
75+ cd ../ myApp
76+ # Check if iOS platform section exists and add deployment target
7777 if grep -q '<platform name="ios">' config.xml; then
78- # Add preference after the opening platform tag
79- sed -i '' '/<platform name="ios">/a\
80- \ \ \ \ <preference name="deployment-target" value="12.0" />
81- ' config.xml
82-
83- - name : Create Cordova app, install plugin then build app
78+ echo "iOS platform section found, adding deployment target preference"
79+ perl -i -pe 's|(<platform name="ios">)|$1\n <preference name="deployment-target" value="12.0" />|g' config.xml
80+ else
81+ echo "iOS platform section not found, adding entire section"
82+ perl -i -pe 's|</widget>| <platform name="ios">\n <preference name="deployment-target" value="12.0" />\n </platform>\n</widget>|g' config.xml
83+ fi
84+ # Verify the change
85+ echo "Config.xml after modification:"
86+ cat config.xml
87+ - name : Build app
8488 run : |
8589 npm config set prefix '~/.npm-global'
8690 export PATH=~/.npm-global/bin:$PATH
87- cd ..; cd myApp;
91+ cd ../ myApp
8892 cordova build ios --verbose
0 commit comments