Skip to content

Latest commit

 

History

History
133 lines (101 loc) · 5.5 KB

README.md

File metadata and controls

133 lines (101 loc) · 5.5 KB

Cordova Plugin

fastlane Plugin Badge

Features

  • Build your Cordova project inside a lane
  • Automatically handle code signing on iOS, even for XCode 8

Getting Started

This project is a fastlane plugin. To get started with fastlane-plugin-cordova, add it to your project by running:

fastlane add_plugin cordova

⚠️ If you're using a Cordova version below 7, you need to use version 1.0.1 of this plugin

Then you can integrate it into your Fastlane setup:

platform :ios do
  desc "Deploy ios app on the appstore"

  lane :deploy do
    match(type: "appstore")
    cordova(platform: 'ios')
    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',
      keystore_alias: 'prod',
      keystore_password: 'password'
    )
    supply(apk: ENV['CORDOVA_ANDROID_RELEASE_BUILD_PATH'])

    # Alternatively, deploy an Android Application Bundle
    # cordova(
    #   package_type: 'bundle',
    #   platform: 'android',
    #   keystore_path: './prod.keystore',
    #   keystore_alias: 'prod',
    #   keystore_password: 'password'
    # )
    # supply(aab: ENV['CORDOVA_ANDROID_RELEASE_BUILD_PATH'])
  end
end

with an Appfile such as

app_identifier "com.awesome.app"
apple_id "[email protected]"
team_id "28323HT"

If using Crosswalk, replace supply(apk: ENV['CORDOVA_ANDROID_RELEASE_BUILD_PATH']) by:

supply(
  apk_paths: [
   'platforms/android/build/outputs/apk/android-armv7-release.apk',
   'platforms/android/build/outputs/apk/android-x86-release.apk'
  ],
)

Plugin API

To check what's available in the plugin, install it in a project and run at the root of the project:

fastlane actions cordova

Which will produce:

Key Description Env Var Default
platform Platform to build on.
Should be either android or ios
CORDOVA_PLATFORM
release Build for release if true,
or for debug if false
CORDOVA_RELEASE true
device Build for device CORDOVA_DEVICE true
type This will determine what type of build is generated by Xcode.
Valid options are development, enterprise, adhoc, and appstore
CORDOVA_IOS_PACKAGE_TYPE appstore
team_id The development team (Team ID) to use for code signing CORDOVA_IOS_TEAM_ID 28323HT
build_flag An array of Xcode buildFlag. Will be appended on compile command. CORDOVA_IOS_BUILD_FLAG []
provisioning_profile GUID of the provisioning profile to be used for signing CORDOVA_IOS_PROVISIONING_PROFILE
package_type This will determine what type of Android build is generated.
Valid options are apk and bundle
CORDOVA_ANDROID_PACKAGE_TYPE apk
keystore_path Path to the Keystore for Android CORDOVA_ANDROID_KEYSTORE_PATH
keystore_password Android Keystore password CORDOVA_ANDROID_KEYSTORE_PASSWORD
key_password Android Key password (default is keystore password) CORDOVA_ANDROID_KEY_PASSWORD
keystore_alias Android Keystore alias CORDOVA_ANDROID_KEYSTORE_ALIAS
min_sdk_version Overrides the value of minSdkVersion CORDOVA_ANDROID_MIN_SDK_VERSION
build_number Build Number for iOS and Android CORDOVA_BUILD_NUMBER
browserify Specifies whether to browserify build or not CORDOVA_BROWSERIFY false
cordova_prepare Specifies whether to run cordova prepare before building CORDOVA_PREPARE true
cordova_no_fetch Specifies whether to run cordova platform add with --nofetch parameter CORDOVA_NO_FETCH false
cordova_build_config_file Call cordova compile with --buildConfig=<ConfigFile> to specify build config file path CORDOVA_BUILD_CONFIG_FILE

Run tests for this plugin

To run both the tests, and code style validation, run

rake

To automatically fix many of the styling issues, use

rubocop -a

Issues and Feedback

For any other issues and feedback about this plugin, please submit it to this repository.

Troubleshooting

If you have trouble using plugins, check out the Plugins Troubleshooting doc in the main fastlane repo.

Using fastlane Plugins

For more information about how the fastlane plugin system works, check out the Plugins documentation.

About fastlane

fastlane is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out fastlane.tools.