Ionic is one of the best HTML5 mobile app development frameworks available in the market, and it is targeted at building hybrid mobile apps. Ionic uses bunch of technologies that most front-end and web developers are already aware of: HTML5, CSS3, and AngularJS. To learn more about Ionic Framework, please visit: http://ionicframework.com/
Jenkins is a great CI tool used by thousand of companies across the world for Automating build processes, Continuous Integration, and Automated Deployments. Jenkins helps organizations automate every aspect of the development and save the developers precious time. To learn about Jenkins, please visit:https://jenkins-ci.org/
Fastlane is a collection of tools for making your iOS deployments hassle-free and effortless. Fastlane allows developers to connect their deployment tools to streamline iOS (and Android) deployment workflows. To learn about Fastlane, please visit: https://fastlane.tools/
You should read this article if you are interested in Continuous integration, love to use the best tools available to get the maximum out of the development process, or are a part of an organization looking at smoothing the build and release process. This article will demonstrate the power of Jenkins for building, packaging, and deploying your iOS apps.
Some of the prerequisites for this article are:
Building iOS apps from Jenkins is something that requires access to the Mac keychain, as well as XCode command line tools installed and available globally.
We can split the entire process into the following tasks:
brew update && brew install jenkins
<key>UserName</key> <string><User name></string> <key>SessionCreate</key> <true />
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.jenkins.plist
Once Jenkins is installed, it should be accessible at: http://<JENKINS_HOST>:8080/
Navigate to Jenkins Plugin Manager http://<JENKINS_HOST>:8080/pluginManager/ and install the following Jenkins plugin:
Install Node and NPM globally by using the Native packages available at:https://nodejs.org/. You can also use Homebrew to install node on your Mac, by using:
brew install node
Once you have installed Node.js, it is time to install the required node packages globally using npm. Install the following node modules using
npm install -g PACKAGE:
Here is the screenshot of “ionic info” command from the Mac Machine that was used to build the IPA for this article:
For building our Ionic Xcode project and creating IPA packages for iOS devices from it, we are going to use the awesome tool Fastlanehttps://fastlane.tools/.
In order to do so, you must:
a) Install the following tools for build:
b) -configure build environment
Make sure all of the required credentials, keys, and the Apple Developer Certificate are present in the Keychain that is going to used during builds
Once we are done installing the required dependencies and tools, we need to configure ‘Fastlane’ so that we can use it for our builds.
To configure Fastlane, go to your ionic project directory and execute #fastlane init and follow the instructions on screen. Once you execute ‘fastlane init’, you should be seeing something like this:
Follow along with the instructions coming on your screen, and configure your ‘Fastfile’ and ‘Appfile’ that are used by the Fastlane tool to build your Ionic iOS project.
To learn how to configure Fastlane for your project, please visit https://fastlane.tools/
Once Fastlane is configured for your project, your Fastfile should look like this:
You can download content of this file from: https://gist.github.com/ravishtiwari/a2992634cb7392ac5399#file-fastfile-rb
You can download the content of the above build script from following Gist: https://gist.github.com/ravishtiwari/a2992634cb7392ac5399#file-ionic-ios-fastlane-sh
Once we have configured both the Jenkins environment and Fastlane for our Ionic project, we are ready to execute the build.
Once Jenkins finished executing the project setup commands (bower install … ionic build ios) and starts executing the ‘fastlane beta’ command, you should see following output on your screen:
Once Fastlane has finished building and signing the IPA for your project, it will start uploading the IPA to Testflight using the credentials provided while setting up the Fastlane.
Once Fastlane has finished uploading your IPA to TestFlight, it will display a message stating the success of TestFlight operation, Fastlane Build stats, etc:
Jenkins is a great and versatile tool. Jenkins has a plugin for all aspects of the build process. Fastlane is a tool that makes your iOS app building, signing, delivery, and almost all aspects of App building and management process effortless. Together, Jenkins and Fastlane make a great combo. You can use Jenkins to manage your builds and Fastlane to build your iOS apps.
If you have any questions related to this article, or want to explore options to use Jenkins for building your Ionic/iOS apps, or any other application, please let us know and we will help your team get the maximum out of your build process.
Sample of scripts used for this article: https://gist.github.com/ravishtiwari/a2992634cb7392ac5399
security find-identity -p codesigning -v : List available identities
security list-keychain : List keychain
security unlock-keychain -u : unlock keychain