CI: Cordova - Build iOS

This implements building the iOS package + uploading the artifact.

It builds successfully though I was unable to get past the loading screen, even locally (not sure what's wrong, might need help).

The QRScanner problem was a journey. It started with trying to install the package via url, from https://github.com/padloc/cordova-plugin-qrscanner and I ran into https://github.com/lerna/lerna/issues/2674 then I tried to simply publish a new package name (`padloc-cordova-plugin-qrscanner`), but as I was replacing the plugin name in the code, it started blowing up in a few different places, and it just felt wrong. Finally, I just created a patch command in `npm`, which can later evolve into a bash script or whatever we need. It's not pretty, but that worked!

The signed command doesn't run yet for iOS because building for the app store will be a separate PR, for publishing, like the other targets.

This will close the development/CI/CD part of #330
This commit is contained in:
Bruno Bernardino 2021-12-29 20:58:35 +00:00
parent a52ee00f19
commit ebb479a4b2
No known key found for this signature in database
GPG Key ID: D1B0A69ADD114ECE
4 changed files with 18 additions and 7 deletions

View File

@ -84,7 +84,12 @@ jobs:
run: |
npm i -g npm@8.2.0
npm ci
# TODO: Still broken
# - name: Build (iOS)
# run: |
# PL_SERVER_URL='${{ secrets.PL_SERVER_URL }}' npm run cordova:build:ios
- name: Build (iOS)
run: |
PL_SERVER_URL='${{ secrets.PL_SERVER_URL }}' npm run cordova:build:ios
- name: Archive Unsigned App (iOS)
uses: actions/upload-artifact@v2
with:
name: padloc-ios-${{ github.sha }}-unsigned.app
path: packages/cordova/platforms/ios/build/emulator/Padloc.app
if-no-files-found: error

View File

@ -30,10 +30,13 @@
"server:start-dry": "lerna run start-dry --stream --scope @padloc/server",
"electron:build": "lerna run build --scope @padloc/electron",
"web-extension:build": "lerna run build --scope @padloc/extension",
"cordova:start:android": "lerna run start:android",
"cordova:start:ios": "lerna run start:ios",
"cordova:build": "lerna run build:android && lerna run build:ios",
"cordova:build:android": "lerna run build:android",
"cordova:build:android:signed": "lerna run build:android:signed",
"cordova:build:ios": "lerna run build:ios",
"cordova:build:ios:signed": "lerna run build:ios:signed",
"start": "npm run pwa:build && lerna run --scope '@padloc/{server,pwa}' --parallel start",
"dev": "lerna run --parallel --scope '@padloc/{server,pwa}' --parallel dev",
"tauri:dev": "lerna run --parallel --scope '@padloc/{server,tauri}' --parallel dev",

View File

@ -2,7 +2,7 @@
This package contains the sources to build the mobile apps for Padloc.
## Requirements
## Requirements (Android)
- Java (1.8+) or OpenJDK (11+)
- Android Studio, with:

View File

@ -77,10 +77,13 @@
},
"scripts": {
"build": "webpack",
"start": "npm run build && cordova run",
"start:android": "npm run build && cordova run android",
"start:ios": "npm run build && npm run patch-ios && cordova run ios",
"prepare-build": "npm run build && cordova prepare",
"patch-ios": "sed -i '' s/UIApplication\\.openSettingsURLString/UIApplicationOpenSettingsURLString/g ./plugins/cordova-plugin-qrscanner/src/ios/QRScanner.swift ./platforms/ios/Padloc/Plugins/cordova-plugin-qrscanner/QRScanner.swift",
"build:android": "npm run prepare-build && cordova build android",
"build:android:signed": "npm run prepare-build && cordova build android --release -- --packageType=apk --keystore=./android-upload-key.keystore --storePassword=$PL_ANDROID_STORE_PASSWORD --alias=$PL_ANDROID_KEYSTORE_ALIAS --password=$PL_ANDROID_STORE_PASSWORD",
"build:ios": "npm run prepare-build && cordova build ios"
"build:ios": "npm run prepare-build && npm run patch-ios && cordova build ios",
"build:ios:signed": "npm run prepare-build && npm run patch-ios && cordova build ios --release -- --packageType=app-store --codeSignIdentity=$PL_IOS_CODE_SIGN_IDENTITY --developmentTeam=$PL_IOS_DEVELOPMENT_TEAM"
}
}