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>Code signing is required for product type 'Application' in SDK 'iOS 10.2'++/code> errors.
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:
++pre>++code>npm install -g cordova
cordova create my-awesome-app com.awesome.app "My Awesome App"
++/code>++/pre>
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.
At the root of your project create a fastlane folder and generate an Appfile and a Fastfile:
++pre>++code>mkdir fastlane
touch fastlane/Appfile fastlane/Fastfile
++/code>++/pre>
Then add the Cordova Fastlane Plugin:
++pre>++code>fastlane add_plugin cordova
++/code>++/pre>
When asked ++code>Should fastlane modify the Gemfile at path 'Gemfile' for you? (y/n)++/code>, reply with ++code>y++/code>.
Then you can integrate the plugin into your Fastlane setup, for example:
++pre>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++/pre>
with an ++code>Appfile++/code> such as
++pre>app_identifier "com.awesome.app"
apple_id "apple@id.com"
team_id "28323HT"++/pre>
Piece of cake now!
For iOS, run ++code>fastlane ios create++/code> once to create your app on the developer member center and iTunes Connect.
Now, you only have to run ++code>fastlane ios deploy++/code> and ++code>fastlane android deploy++/code> to deploy to the stores!