Firebase App Distribution Fastlane Plugin

repository·main·Indexed 41 days ago

https://github.com/firebase/fastlane-plugin-firebase_app_distribution

A fastlane plugin to automate distributing iOS and Android app builds (IPA, APK, AAB) to testers via Firebase App Distribution. Includes actions for releasing builds, managing tester groups, adding testers in bulk, and retrieving the latest release data.

Tokens
5.7K
Snippets
15
Records
21
Agent score
52%

What's inside Firebase App Distribution Fastlane Plugin

  1. Access uploaded release data via Shared Values

    main

    After a successful execution of firebase_app_distribution, the action populates the lane_context with a hash representing the uploaded release. You can access this using the shared value :FIREBASE_APP_DISTRO_RELEASE.

    # In your Fastfile
    firebase_app_distribution(...)
    
    release = Actions.lane_context[SharedValues::FIREBASE_APP_DISTRO_RELEASE]
    puts "Uploaded release version: #{release[:display_version]}"
  2. Handle AAB test certificate fingerprints

    main

    When uploading an Android App Bundle (AAB) for the first time, Firebase App Distribution generates a new test certificate. All subsequent AAB uploads are re-signed with this certificate. The action will output the following fingerprints to the console so you can register your app signing key with providers like Google Sign-In or Google Maps:

    • MD5 certificate fingerprint
    • SHA-1 certificate fingerprint
    • SHA-256 certificate fingerprint
  3. Access the latest release via lane_context

    main

    When firebase_app_distribution_get_latest_release is executed, it stores the resulting release hash in the Fastlane lane_context. You can access this value later in your lane using the shared value key FIREBASE_APP_DISTRO_LATEST_RELEASE.

    # After calling the action
    latest_release = Actions.lane_context[:FIREBASE_APP_DISTRO_LATEST_RELEASE]
  4. Troubleshoot firebase_app_distribution_remove_testers errors

    main

    When using firebase_app_distribution_remove_testers, you may encounter the following errors:

    Project and Group Errors

    • Invalid Project: Occurs if the project_number is not found (HTTP 404 during project removal).
    • Invalid Tester Group: Occurs if the provided group_alias does not exist (HTTP 404 during group removal).

    Tester and Input Errors

    • Invalid Email Address: Occurs if one or more provided emails are malformed (HTTP 400 during group removal).
    • Missing Input: Occurs if neither emails nor file is specified.
    • Empty List: Occurs if the resulting email list is empty.
    • Too Many Testers: Occurs if you attempt to remove more than 1000 testers at once.
  5. Troubleshooting firebase_app_distribution_create_group errors

    main

    When using firebase_app_distribution_create_group, you may encounter the following errors:

    • Invalid Tester Group Name: Occurs if the provided alias is invalid (HTTP 400).
    • Invalid Project: Occurs if the project_number cannot be found (HTTP 404).
    • Group Already Exists: If a group with the same alias already exists, the action will issue an important warning rather than failing (HTTP 409).

    If an error occurs that does not match these cases, the action will crash with the underlying Google API error.

  6. Add testers via firebase_app_distribution_add_testers

    main

    The firebase_app_distribution_add_testers action allows you to create or add testers to your Firebase App Distribution project in bulk. You can provide testers as a comma-separated list of emails or by pointing to a file containing a comma-separated list.

    Key Behaviors

    • Bulk Limit: You can add a maximum of 1000 testers at a single time.
    • Group Assignment: If you provide a group_alias, testers will be added to that specific group (which must already exist). If group_alias is omitted, testers are added directly to the project.
    • Response Behavior: The action reports success if the request is processed, but because the underlying API returns all testers in the request regardless of whether they were newly created or already existed, the action cannot provide an exact count of newly created testers.

    Error Handling

    Common errors returned by this action include:

    • INVALID_EMAIL_ADDRESS (HTTP 400)
    • INVALID_PROJECT (HTTP 404)
    • INVALID_TESTER_GROUP (HTTP 404 when using group_alias)
    • TESTER_LIMIT_VIOLATION (HTTP 429)
    firebase_app_distribution_add_testers(
      project_number: "1234567890",
      emails: "tester1@example.com, tester2@example.com",
      group_alias: "my-testers-group"
    )
  7. Delete a tester group with firebase_app_distribution_delete_group

    main

    Use the firebase_app_distribution_delete_group action to remove a tester group from your Firebase App Distribution project. This action requires a project number and the alias of the group you wish to delete.

    firebase_app_distribution_delete_group(
      project_number: "1234567890",
      alias: "my-tester-group",
      service_credentials_file: "path/to/credentials.json"
    )
  8. Download tester UDIDs with firebase_app_distribution_get_udids

    main

    The firebase_app_distribution_get_udids action downloads the Unique Device Identifiers (UDIDs) of your Firebase App Distribution testers. This is useful for iOS development, as you can export these identifiers to a file and import them into your Apple Developer account using the 'Register Multiple Devices' option to update your provisioning profiles.

    Note: This action is only supported on the :ios platform.

    firebase_app_distribution_get_udids(
      app: "<your Firebase app ID>",
      output_file: "tester_udids.txt",
    )
  9. Create a tester group with firebase_app_distribution_create_group

    main

    Use the firebase_app_distribution_create_group action to create a new tester group in Firebase App Distribution. This action requires a project number, a unique alias for the group, and a display name.

    Parameters

    ParameterEnv VarTypeRequiredDescription
    project_numberFIREBASEAPPDISTRO_PROJECT_NUMBERIntegerYesYour Firebase project number (found in Firebase Console General Settings).
    aliasFIREBASEAPPDISTRO_CREATE_GROUP_ALIASStringYesThe unique alias for the group.
    display_nameFIREBASEAPPDISTRO_CREATE_GROUP_DISPLAY_NAMEStringYesThe human-readable display name for the group.
    service_credentials_fileN/AStringNoPath to your Google service credentials JSON file.
    service_credentials_json_dataN/AStringNoRaw JSON content of your Google service account credentials.
    firebase_cli_tokenN/AStringNoAuth token generated via firebase login:ci.
    debugN/ABooleanNoIf set to true, prints verbose debug output.
    firebase_app_distribution_create_group(
      project_number: "1234567890",
      alias: "qa-team",
      display_name: "QA Team Group",
      service_credentials_file: "path/to/credentials.json"
    )
  10. Use the firebase_app_distribution action

    main

    The firebase_app_distribution action allows you to release beta builds to Firebase App Distribution. It supports uploading IPA (iOS), APK, or AAB (Android) binaries, attaching release notes, distributing to specific testers or groups, and running automated tests on selected devices (beta feature).

    firebase_app_distribution(
      app: "<your Firebase app ID>",
      testers: "snatchev@google.com, rebeccahe@google.com",
      test_devices: "model=shiba,version=34,locale=en,orientation=portrait;model=b0q,version=33,locale=en,orientation=portrait",
    )