Skip to content

Latest commit

 

History

History
259 lines (183 loc) · 11.8 KB

README.md

File metadata and controls

259 lines (183 loc) · 11.8 KB

Ionic Fastlane Plugin

ionic-fastlane-plugin

fastlane plugin for Ionic 4+.

Table of content

Getting started

Install the ionic-fastlane plugin

fastlane add_plugin fastlane-plugin-fivethree_ionic

This will add gem 'fastlane-plugin-fivethree_ionic' in the fastlane/Pluginfile.

Actions

This Fastfile contains example of the following actions.

Action Description
fiv_add_transparent_statusbar
fiv_build_ionic_android
fiv_android_keystore Generate an Android keystore file or validate keystore exists
fiv_build_ionic_android
fiv_bump_version
fiv_clean_install
fiv_increment_build_no
fiv_ionic Build your Ionic app for a specific platform
fiv_select_client Select a client for white labeling the app
fiv_select_clients Select all, many or one client for white labeling the app
fiv_select_env Select an environment folder for white labeling the app
fiv_sign_android Zipalign, sign and verify apk
fiv_update_version
fiv_update_version_and_build_no
fiv_version

fiv_add_transparent_statusbar

fiv_android_keystore

Generate an Android keystore file or validate keystore exists

Options

Options Description Type Default Required
keystore_path Path to the android string ./fastlane/android false
keystore_name Name of the keystore string true
key_alias Key alias of the keystore string true

fiv_build_ionic_android

fiv_bump_version

fiv_clean_install

fiv_increment_build_no

fiv_ionic

Build your Ionic app for iOS:

outputpath =
  fiv_ionic(
    platform: 'ios', release: 'true', prod: 'true', team_id: 'YOUR_TEAM_ID'
  )

Build your Ionic app for Android:

outputpath = fiv_ionic(platform: 'android', release: 'true', prod: 'true')

Options

Options Description Type Default
platform Platform to build on. Can be android, ios or browser android | browser | ios
prod Build for production true | false false
release Build for release if true, or for debug if false true | false true
team_id The development team (Team ID) to use for code signing string
type This will determine what type of build is generated by Xcode. Valid options are development, enterprise, adhoc, and appstore development | enterprise | adhoc | appstore appstore

fiv_select_client

Add fiv_select_client to your lane to select a client for copying client specific resources before your app build.

For example you have the following app clients:

  • clients
    • companyA
      • resources
      • ...
    • companyB
    • companyZ

fiv_select_client() lets you select one client and returns the client name.

client = fiv_select_client

# copy client resources e.g. "cp ../clients/#{client}/resources ../"
# build app

CI

Client selection can also be passed as an option for a non interactive environment. Add the option client to before_all and assign it to an environment variable CLIENT.

before_all { |lane, options| ENV['CLIENT'] = options[:client] }

fastlane example_lane client:companyA

Options

Options Description Type Default Required
clients_folder Path to your clients white label resources string clients false

fiv_select_clients

Add fiv_select_clients to your lane to select all, many or one client for copying client specific resources before your app build in a loop.

For example you have the following app clients:

  • clients
    • companyA
      • resources
      • ...
    • companyB
    • companyZ

fiv_select_clients() lets you select all, many or one client and returns an array of client names.

clients = fiv_select_clients

clients.each { |client| }

CI

Clients selection can also be passed as an option for a non interactive environment. Add the option clients to before_all and assign it to an environment variable CLIENTS.

before_all { |lane, options| ENV['CLIENTS'] = options[:clients] }

Seperate clients by ,:

fastlane example_lane clients:companyA,companyB

Options

Options Description Type Default Required
clients_folder Path to your clients white label resources string clients false

fiv_select_env

Add fiv_select_env to your lane to select an environment of a client for copying specific resources for this environment before your app build. e.g the resources or app icon and splash screen might differ for each environment.

For example you have the following app clients with different environments:

  • clients
    • companyA
      • resources
      • environment
        • prod
          • resources
        • qa
          • resources
        • test
          • resorces
    • companyB
    • companyZ

fiv_select_env() lets you select one client and returns the client name.

client = fiv_select_client
env = fiv_select_env(client: client)

# copy client resources from environment e.g. "cp ../clients/#{client}/enviroment/#{env}/resources ../"
# build app

CI

Environment selection can also be passed as an option for a non interactive environment. Add the option env to before_all and assign it to an environment variable ENV.

before_all do |lane, options|
  ENV['CLIENT'] = options[:client]
  ENV['ENV'] = options[:env]
end

fastlane example_lane client:companyA env:prod

Options

Options Description Type Default Required
clients_folder Path to your clients white label resources string clients false
environments_folder Path to your environments white label resources string environments false
client Path to your selected client string true

fiv_sign_android

Zipaligns, signs v2 and verifys an apk with a keystore. If the keystore does not exists it uses fiv_android_keystore to create a new keystore.

# run before signing: ionic cordova build android --prod --release

apk_path =
  fiv_sign_android(
    keystore_name: 'pizza',
    key_alias: 'pizza',
    app_version: '1.0.1',
    app_build_no: '2020',
    apk_output_dir: './apk',
    silent: true
  )

Options

Options Description Type Default Required
keystore_path Path to the android string ./fastlane/android false
keystore_name Name of the keystore used to store storepass and keypass in keychain string true
android_sdk_path Path to your installed Android SDK string ~/Library/Android/sdk false
android_build_tool_version Android Build Tool version used for zipalign, sign and verify string 28.0.3 false
apk_source Android Build Tool version used for zipalign, sign and verify string ./platforms/android/app/build/outputs/apk/release/app-release-unsigned.apk false
apk_zipalign_target Target path for the zipaligned apk string ./platforms/android/app/build/outputs/apk/release/app-release-unsigned-zipalign.apk false
apk_signed_target Target path of the signed apk string ./platforms/android/app/build/outputs/apk/release false
key_alias Key alias of the keystore string true
app_version App version string true
app_build_no App build number string true

fiv_update_version

fiv_update_version_and_build_no

fiv_version