iosfastlanefastlane-gym

Fastlane Gym export with auto sign always uses Release bundle ID


I am using the below fastfile script for my auto signed app

lane :build_and_deploy do
    api_key = app_store_connect_api_key(
        key_id: "XXXX",
        issuer_id: "XXX",
        key_filepath: "/Users/runner/AuthKey_XXXX.p8"
    )

    begin
        gym(
            #scheme: scheme,
            skip_package_ipa: true,
            export_method: 'development',
            xcargs: '-allowProvisioningUpdates -onlyUsePackageVersionsFromResolvedFile -parallelizeTargets CURRENT_PROJECT_VERSION=9840 MARKETING_VERSION=2.0.7 -authenticationKeyID XXXX -authenticationKeyIssuerID XXX -authenticationKeyPath /Users/runner/AuthKey_XXXX.p8'
        )

        archive_path = lane_context[SharedValues::XCODEBUILD_ARCHIVE]
            
        gym(
            archive_path: archive_path,
            skip_build_archive: true,
          
            project: "helloSports.xcodeproj",
            scheme:  "helloSports",
            clean: true,
            xcargs: '-allowProvisioningUpdates -disableAutomaticPackageResolution -authenticationKeyID XXXX -authenticationKeyIssuerID XXX -authenticationKeyPath /Users/runner/AuthKey_XXXX.p8',
            skip_package_dependencies_resolution: true,

            #export_method: "app-store",
            export_method: "development",
        )

I can understand for "app-store" export method the release bundle ID can be used, but for "development" bundle ID shouldn't the debug bundle ID be used? or in other words when will the debug bundle ID be used for exporting anyway??


Solution

  • The solution is to implement configuration in Gymfile as explained here. Further improved it by allowing the configuration to be changed in runtime using the pipeline environment variable

    debug_run = ENV['DEBUG_PIPELINE'].to_s
    if debug_run.empty?
      configuration 'Release'
    else
      configuration 'Debug'
    end