bamlab/fastlane-plugin-cordova

Using match build fails the second time

lockenj opened this issue · 2 comments

Hey gang! Love the plugin great work on this guys.

The issue I see is when match runs the first time and installs the development provisioning profile it sets ENV["SIGH_UUID"] which this plugin sees and provides --provisioningProfile=... on to the cordova compile command. If this is run after the provisioning profile has been installed ENV["SIGH_UUID"] is not set and the provisioningProfile flag is not passed, this results in a build failure

Code Signing Error: No profiles for '<MYAPP>' were found: Xcode couldn't find any iOS App Development provisioning profiles matching '<MYAPP>'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild.

Here is the lane:

lane :build do
    UI.message "ios build()"
    match(
        type: 'development'
    )
    cordova(
      platform: 'ios',
      release: false,
      type: 'development'
    )
end

Workaround

I have worked around this issue by making a second call directly to get_provisioning_profile this seems to have the side affect of setting ENV["SIGH_UUID"]. Does anyone have a better workaround for this?

lane :build do
    UI.message "ios build()"
    match(
      type: 'development'
    )
    get_provisioning_profile(
      development: true,
      skip_install: true,
      app_identifier: 'com.wonky.mobile',
      readonly: true
    )
    cordova(
      platform: 'ios',
      release: false,
      type: 'development'
    )
  end

For the record my workaround didn't entirely fix the issue. If the app was deleted and recreated (as it is in my CI environment) using the same bundle id without nuking the provisioning profiles this fails. So my latest worked around is this.

  lane :build do
    match(
      type: 'development'
    )
    ENV['SIGH_UUID'] = ENV['sigh_com.wonky.mobile_development'];
    cordova(
      platform: 'ios',
      release: false,
      type: 'development'
    )
  end

Anyone have any better ideas?

Closing this as the project that needed this has since been deprecated.