Introducing our new Cordova plugin for Fastlane

Deploying your Cordova or Ionic app to the stores manually can be a painful experience. 
It is time-consuming, error prone and not beginner-friendly. Fortunately, Fastlane helps you automate the process.

We created a Cordova Fastlane Plugin to help you setup your deployment process. 
It will build your Cordova app and automatically manage codesigning. It works for both Android and iOS, even with XCode 8! 
No more Code signing is required for product type 'Application' in SDK 'iOS 10.2'errors.

Have a Cordova app at the ready

Say we have a Cordova app (or an Ionic app) that we want to deploy to the stores.

If you don’t have one already, run for example:

npm install -g cordova
cordova create my-awesome-app com.awesome.app "My Awesome App"

Set up a private repository for iOS certificates and profiles

Match is awesome for handling your team certificates and your provisioning profiles. It will store them in a private git repo for you. See the fastlane codesigning guide for more info.

Create a private repository for match if you haven’t done so yet. Bitbucket is a well known free option.

Use the Cordova Fastlane plugin

At the root of your project create a fastlane folder and generate an Appfile and a Fastfile:

mkdir fastlane
touch fastlane/Appfile fastlane/Fastfile

Then add the Cordova Fastlane Plugin:

fastlane add_plugin cordova

When asked Should fastlane modify the Gemfile at path 'Gemfile' for you? (y/n), reply with y.

Then you can integrate the plugin into your Fastlane setup, for example:

platform :ios do
desc "Deploy ios app on the appstore"
  lane :create do
produce(app_name: "myapp")
end
  lane :deploy do
match(
type: "appstore",
git_url: "https://bitbucket.org/Almouro/certificates" # REPLACE WITH YOUR PRIVATE REPO FOR MATCH
)
cordova(platform: 'ios') # Using the Cordova Fastlane Plugin
appstore(ipa: ENV['CORDOVA_IOS_RELEASE_BUILD_PATH'])
end
end
platform :android do
desc "Deploy android app on play store"
  lane :deploy do
cordova(
platform: 'android',
keystore_path: './prod.keystore', # REPLACE THESE LINES WITH YOUR KEYSTORE INFORMATION
keystore_alias: 'prod',
keystore_password: 'password'
) # Cordova Fastlane Plugin
supply(apk: ENV['CORDOVA_ANDROID_RELEASE_BUILD_PATH'])
end
end

with an Appfile such as

app_identifier "com.awesome.app"
apple_id "apple@id.com"
team_id "28323HT"

Piece of cake now!

For iOS, run fastlane ios create once to create your app on the developer member center and iTunes Connect.

Now, you only have to run fastlane ios deploy and fastlane android deploy to deploy to the stores!

Where to go from here

  • You can see all the plugin options by running fastlane actions cordova at the root of your Cordova app.
  • The Fastlane docs are great to learn more about how it can ease your life.
  • If you have any issue or idea for improvement on the plugin, please make them know here.