Home

Awesome

App Center fastlane plugin

fastlane Plugin Badge Gem Version Build Status

Getting Started

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

fastlane add_plugin appcenter

fastlane v2.96.0 or higher is required for all plugin-actions to function properly.

About App Center

With App Center you can continuously build, test, release, and monitor your apps. This plugin provides a set of actions to interact with App Center.

appcenter_fetch_devices allows you to obtain the list of iOS devices to distribute an app to (useful for automatic provisioning of testers' devices).

appcenter_upload allows you to upload and distribute apps to your testers on App Center as well as to upload .dSYM files to collect detailed crash reports in App Center.

appcenter_fetch_version_number allows you to obtain the latest version number (short or full) for an app. This is useful for tasks such as getting the latest version of an app so that an increment action can take place on CI, or checking that an upload has been successful.

appcenter_codepush_release_react allows you to deploy app updates via CodePush.

Usage

To get started, first, obtain an API token in App Center. The API Token is used to authenticate with the App Center API in each call.

appcenter_fetch_devices(
  api_token: "<appcenter token>",
  owner_name: "<appcenter account name of the owner of the app (username or organization URL name)>",
  app_name: "<appcenter app name>",
  destinations: "*", # Default is 'Collaborators', use '*' for all distribution groups
  devices_file: "devices.txt" # Default. If you customize, the extension must be .txt
)
appcenter_upload(
  api_token: "<appcenter token>",
  owner_name: "<appcenter account name of the owner of the app (username or organization URL name)>",
  owner_type: "user", # Default is user - set to organization for appcenter organizations
  app_name: "<appcenter app name (as seen in app URL)>",
  file: "<path to android build binary>",
  notify_testers: true # Set to false if you don't want to notify testers of your new release (default: `false`)
)
appcenter_fetch_version_number(
  api_token: "<appcenter token>",
  owner_name: "<appcenter account name of the owner of the app (username or organization URL name)>",
  app_name: "<appcenter app name (as seen in app URL)>",
  version: "a specific version to get the last release for" # optional, don't set this value to get the last upload of all versions
)

The appcenter_fetch_version_number returns a hash that contains the id, the version number, and the build number. The version corresponds to the short_version and the build number to the version known by App Center for a given release:

{"id"=>1, "version"=>"1.0.0", "build_number"=>"1.0.0.1234"} # iOS apps contain the full version plus build number due to the way that Apple use CFBundleVersion for this value
{"id"=>588, "version"=>"1.2.0", "build_number"=>"1615"}
appcenter_codepush_release_react(
  api_token: "<appcenter token>",
  owner_name: "<appcenter account name of the owner of the app (username or organization URL name)>",
  app_name: "<appcenter app name (as seen in app URL)>",
  deployment: "Staging"
)

Help

Once installed, information and help for an action can be printed out with this command:

fastlane action appcenter_upload # or any action included with this plugin

A note on App Name

The app_name and owner_name as set in the Fastfile come from the app's URL in App Center, in the below form:

https://appcenter.ms/users/{owner_name}/apps/{app_name}

They should not be confused with the displayed name on App Center pages, which is called app_display_name instead.

Parameters

The action parameters api_token, owner_name, app_name, and others can also be omitted when their values are set as environment variables. By default, appcenter_upload will use the same api_token, owner_name, and app_name you used in appcenter_fetch_devices.

Here is the list of all existing parameters:

appcenter_fetch_devices

Key & Env VarDescription
api_token <br/> APPCENTER_API_TOKENAPI Token for App Center
owner_name <br/> APPCENTER_OWNER_NAMEOwner name, as found in the App's URL in App Center
destinations <br/> APPCENTER_DISTRIBUTE_DESTINATIONSComma separated list of distribution group names. Default is 'Collaborators', use '*' for all distribution groups
devices_file <br/> FL_REGISTER_DEVICES_FILEFile to save the devices list to. Same environment variable as fastlane's register_devices action

appcenter_upload

Key & Env VarDescription
api_token <br/> APPCENTER_API_TOKENAPI Token for App Center
owner_type <br/> APPCENTER_OWNER_TYPEOwner type, either 'user' or 'organization' (default: user)
owner_name <br/> APPCENTER_OWNER_NAMEOwner name as found in the App's URL in App Center
app_name <br/> APPCENTER_APP_NAMEApp name as found in the App's URL in App Center. If there is no app with such name, you will be prompted to create one
app_display_name <br/> APPCENTER_APP_DISPLAY_NAMEApp display name to use when creating a new app
app_os <br/> APPCENTER_APP_OSApp OS can be Android, iOS, macOS, Windows, Custom. Used for new app creation, if app 'app_name' was not found
app_platform <br/> APPCENTER_APP_PLATFORMApp Platform. Used for new app creation, if app 'app_name' was not found
file <br/> APPCENTER_DISTRIBUTE_FILEFile path to the release build to publish
upload_build_only <br/> APPCENTER_DISTRIBUTE_UPLOAD_BUILD_ONLYFlag to upload only the build to App Center. Skips uploading symbols or mapping (default: false)
dsym <br/> APPCENTER_DISTRIBUTE_DSYMPath to your symbols file. For iOS provide path to app.dSYM.zip
upload_dsym_only <br/> APPCENTER_DISTRIBUTE_UPLOAD_DSYM_ONLYFlag to upload only the dSYM file to App Center (default: false)
mapping <br/> APPCENTER_DISTRIBUTE_ANDROID_MAPPINGPath to your Android mapping.txt
upload_mapping_only <br/> APPCENTER_DISTRIBUTE_UPLOAD_ANDROID_MAPPING_ONLYFlag to upload only the mapping.txt file to App Center (default: false)
destinations <br/> APPCENTER_DISTRIBUTE_DESTINATIONSComma separated list of destination names, use '*' for all distribution groups if destination type is 'group'. Both distribution groups and stores are supported. All names are required to be of the same destination type (default: Collaborators)
destination_type <br/> APPCENTER_DISTRIBUTE_DESTINATION_TYPEDestination type of distribution destination. 'group' and 'store' are supported (default: group)
mandatory_update <br/> APPCENTER_DISTRIBUTE_MANDATORY_UPDATERequire users to update to this release. Ignored if destination type is 'store' (default: false)
notify_testers <br/> APPCENTER_DISTRIBUTE_NOTIFY_TESTERSSend email notification about release. Ignored if destination type is 'store' (default: false)
release_notes <br/> APPCENTER_DISTRIBUTE_RELEASE_NOTESRelease notes (default: No changelog given)
should_clip <br/> APPCENTER_DISTRIBUTE_RELEASE_NOTES_CLIPPINGClip release notes if its length is more then 5000, true by default (default: true)
release_notes_link <br/> APPCENTER_DISTRIBUTE_RELEASE_NOTES_LINKAdditional release notes link
build_number <br/> APPCENTER_DISTRIBUTE_BUILD_NUMBERThe build number, required for macOS .pkg and .dmg builds, as well as Android ProGuard mapping.txt when using upload_mapping_only
version <br/> APPCENTER_DISTRIBUTE_VERSIONThe build version, required for .pkg, .dmg, .zip and .msi builds, as well as Android ProGuard mapping.txt when using upload_mapping_only
timeout <br/> APPCENTER_DISTRIBUTE_TIMEOUTRequest timeout in seconds applied to individual HTTP requests. Some commands use multiple HTTP requests, large file uploads are also split in multiple HTTP requests
dsa_signature <br/> APPCENTER_DISTRIBUTE_DSA_SIGNATUREDSA signature of the macOS or Windows release for Sparkle update feed
ed_signature <br/> APPCENTER_DISTRIBUTE_ED_SIGNATUREEdDSA signature of the macOS or Windows release for Sparkle update feed
strict <br/> APPCENTER_STRICT_MODEStrict mode, set to 'true' to fail early in case a potential error was detected

appcenter_fetch_version_number

Key & Env VarDescription
api_token <br/> APPCENTER_API_TOKENAPI Token for App Center
owner_name <br/> APPCENTER_OWNER_NAMEOwner name, as found in the App's URL in App Center
app_name <br/> APPCENTER_APP_NAMEApp name as found in the App's URL in App Center. If there is no app with such name, you will be prompted to create one
version <br/> APPCENTER_APP_VERSIONApp version to get the last release for instead of the last release of all versions

appcenter_codepush_release_react

Key & Env VarDescription
api_token <br/> APPCENTER_API_TOKENAPI Token for App Center
owner_name <br/> APPCENTER_OWNER_NAMEOwner name, as found in the App's URL in App Center
app_name <br/> APPCENTER_APP_NAMEApp name as found in the App's URL in App Center. If there is no app with such name, you will be prompted to create one
deployment <br/> APPCENTER_CODEPUSH_DEPLOYMENTName of deployment track (default: Staging)
target_version <br/> APPCENTER_CODEPUSH_TARGET_VERSIONTarget binary app version
mandatory <br/> APPCENTER_CODEPUSH_MANDATORYSpecifies whether the update should be mandatory (default: true)
description <br/> APPCENTER_CODEPUSH_DESCRIPTIONDescription of CodePush release
dry_run <br/> APPCENTER_CODEPUSH_DRY_RUNPrint command that would be run, don't run it (default: false)
disabled <br/> APPCENTER_CODEPUSH_DISABLEDSpecifies whether this release should not be immediately available for download (default: false)
no_duplicate_release_error <br/> APPCENTER_CODEPUSH_NO_DUPLICATE_ERRORSpecifies whether to ignore errors if bundle is identical to the latest codepush release (default: false)
bundle_name <br/> APPCENTER_CODEPUSH_BUNDLE_NAMESpecifies the name of the bundle file
output_dir <br/> APPCENTER_CODEPUSH_OUTPUTSpecifies path to where the bundle and sourcemap should be written
sourcemap_output <br/> APPCENTER_CODEPUSH_SOURCEMAP_OUTPUTSpecifies path to write sourcemaps to
development <br/> APPCENTER_CODEPUSH_DEVELOPMENTSpecifies whether to generate dev or release build (default: false)
private_key_path <br/> APPCENTER_CODEPUSH_PRIVATE_KEY_PATHSpecifies path to private key that will be used for signing bundles
extra_bundler_options <br/> APPCENTER_CODEPUSH_EXTRA_BUNDLER_OPTIONSA list of extra options that get passed to the react-native bundler

Example

Check out this example Fastfile to see how to use the appcenter_upload action. Try it by cloning the repo, running fastlane install_plugins and bundle exec fastlane test.

Sample uses .env for setting private variables like API token, owner name, .etc. You need to replace it in Fastfile by your own values.

There are three examples in test lane:

Check out this example Fastfile for a full example of fetching devices, registering them with Apple, provisioning the devices, and signing an app.

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 open a GitHub issue.

Troubleshooting

If you have trouble using plugins, check out the Plugins Troubleshooting guide.

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.

Contributing

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Security

Check out SECURITY.md for any security concern with this project.

Contact

We're on Twitter as @vsappcenter. Additionally you can reach out to us on the App Center portal. Open the "?" menu on the top right corner of screen, then use "Contact support" to file a support ticket. Our support team is there to answer your questions and help you solve your problems.