PlusService App Deployment
iOS
The iOS App can be build & uploaded using Fastlane Tools. Fastlane also manages all keys and provisioning files, so you never have to manually generate certificates inside the iOS Developer Portal.
Prerequisite
Make sure to have fastlane installed by running gem install fastlane, or you
can simply run the bootstrap file: To setup your local environment navigate
into the automatic-build folder and run ./bootstrap.sh.
To use Fastlane Match, make sure you have access to the iOS Certificates Repository.
When running Fastlane for the first time, you might be asked to insert credentials like the password to the iTunes Connect account. These will be stored inside your keychain afterwards.
Slack Configuration
Fastlane can write its results into a Slack channel. We have specified a SLACK_URL inside the Appfile, which is gathered from the GATES-Services Slack settings page for Incoming Webhooks
Fastlane Configuration
To run Fastlane smoothly we need some configuration files. All of these files are inside automatic-build and automatic-build/fastlane. These files are templates which will be automatically copied and filled by the build.ios.sh script!
- template.entitlements: Needed to set the correct Push Notification information inside the iOS Project
- .env_tpl: The Template for general Environment variables
- Appfile_tpl: Template for App specific information
- Gymfile_tpl: Template for the Gym Tool of Fastlane to build the app
- Matchfile_tpl: Template for the Match Tool to grab the correct certificates and keys
If everything works as usual, don't touch these files and let the build script and Fastlane do the magic.
Fastlane Lanes
Fastlane tasks are called lanes. Inside our Fastfile we have defined 2 lanes for our app:
- beta: The lane to handle the build of the native project, sign and upload to TestFlight
- bootstrap_provisions: The lane to create profiles for a new app
We only need the bootstrap_provisions if we create a new app and want to
generate the needed certificates automatically.
The beta lane performs these specific steps:
- match: Load the right certificates for the client configured
- Copy the entitlements file into the native project
- update_project_codesigning: Update the signing inside the project
- Patch Project Settings: Do some manually tweaking to set the correct profiles inside Xcode and load the entitlements
- latest_testflight_build_number: Loads the latest build Number from ITC
- increment_build_number: Increments the previously received build number
- gym: Actually builds our native project into an IPA file
- testflight: Uploads the previously created IPA file to TestFlight
- slack: Posts a message to the predefined Slack channel
If an error occurs, check the Fastlane log or run the lane with --verbose to
get a evene more detailed debug log.
The most problems inside this part can arise from patching the project settings. This part currently works, but if Apple changes the signing system you might need to tinker a bit around to get all the files where you need them.
If you need more information about the Fastlane actions like
increment_build_number, check out the detailed Fastlane documentation for
help!
Building the iOS App
To build the iOS for local testing, proceed like before by running
./build.ios.sh DEMO_100 where the last part is the client ID.
If you want to automatically upload the iOS build to TestFlight, you can run
./build.ios.sh DEMO_100 release This command will build the iOS app like
before, navigate into the automatic-build folder and run fastlane beta to run
our Beta release lane.
If everything finishes successful (which can take ~10 minutes), Fastlane will post a message to the plusserviceapp channel.
Inside the ITC portal our app will appear soon in the TestFlight area. If there was a previous build for the same version active inside the testing, the new build will be automatically set as the new testing version and active testers will receive a notification.
If you have already build the iOS Version before and just want to upload it,
you can also run ./build.ios.sh DEMO_100 release nobuild
Android
To build the Android app for local testing, simply run ./build.sh DEMO_100
where the last part is the client ID.
There is currently no local upload feature, only the Jenkis has an automatic build step to submit new version to the Google Play alpha stage. However, this process could aslo be integrated into Fastlane by following the appfoundry tutorial
Troubleshooting & FAQ
- The automatic iOS deployment does not work for EVO (deprecated)! For this client, use the standard archive and upload features inside Xcode
- After Building the App with Fastlane, running the local Xcode project might give errors. It is configured exactly for release configuration, so don't mind these problems and rebuild the app with Ionic if needed.