Skip to content

fix CI

fix CI #103

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Cordova GitHub CI #
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
test:
# The type of runner that the job will run on
runs-on: macos-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: "22"
- name: Cache Node.js modules
uses: actions/cache@v3
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install Dependencies
run: npm ci
- name: Lint Plugin
run: npm run lint
- name: Build Plugin
run: npm run build
- name: Install Cordova CLI
env:
CORDOVA_VERSION: "11"
run: |
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATH
npm install cordova@$CORDOVA_VERSION -g
- name: Create Cordova app, install plugin
env:
CORDOVA_IOS_VERSION: "latest"
run: |
npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATH
cd ..; cordova create myApp org.apache.cordova.myApp myApp; cd myApp;
cordova platform add ios@$CORDOVA_IOS_VERSION --verbose
cordova plugin add ../cordova-plugin-iosrtc --verbose
- name: Set iOS Deployment Target
run: |
npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATH
cd ../myApp
# Check if iOS platform section exists and add deployment target
if grep -q '<platform name="ios">' config.xml; then
echo "iOS platform section found, adding deployment target preference"
perl -i -pe 's|(<platform name="ios">)|$1\n <preference name="deployment-target" value="12.0" />|g' config.xml
else
echo "iOS platform section not found, adding entire section"
perl -i -pe 's|</widget>| <platform name="ios">\n <preference name="deployment-target" value="12.0" />\n </platform>\n</widget>|g' config.xml
fi
# Verify the change
echo "Config.xml after modification:"
cat config.xml
- name: Build app
run: |
npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATH
cd ../myApp
cordova build ios --verbose