bamlab / fastlane-plugin-cordova

Integrate your Cordova build into your Fastlane setup

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong Provisioning Profile

dmastag opened this issue · comments

First of all, thanks for the GREAT Plugin!!!

Now to my problem, I am currently using this lane:

platform :ios do
  desc "Deploy ios app on the appstore"
  lane :beta do
    sh "echo APP_ID ENV['APP_ID'] APP_NAME ENV['APP_NAME']"
    unlock_keychain(
       path: "~/Library/Keychains/login.keychain-db"
    )
    match(
      type: "appstore",
      git_url: "git@xxx.xxx.xxx.xxx:url/certificates.git",
      app_identifier: ENV["APP_ID"]
    )
    cordova(platform: 'ios') # Using the Cordova Fastlane Plugin
    testflight(ipa: ENV['CORDOVA_IOS_RELEASE_BUILD_PATH'], skip_waiting_for_build_processing: true)
  end
end

The problem I have is that I have 2 app_identifiers:

app_identifier ["com.mycomp.app1", "com.mycomp.app2"]

The right provisioning file is used by cordova if its app1 but when app2 then cordova is using the wrong provisioningUuid

cordova build ios --release --device --packageType=app-store --developmentTeam=XXXXXX --provisioningProfile=XXXXXXX  -- 

So what I am asking is, how do I get the correct provisioningId from match and put it into cordova (I assume I have to use the provisioning_profile option)?

So I was checking my gitlab ci logs and found that it spits out the data:

[08:57:07]: Installing provisioning profile...
[08:57:08]: Installing provisioning profile...

+---------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------+
|                                                                             �[32mInstalled Provisioning Profile�[0m                                                                              |
+---------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------+
| Parameter           | Environment Variable                              | Value                                                                                                         |
+---------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------+
| App Identifier      |                                                   | com.mycompany.myapp1                                                                                        |
| Type                |                                                   | appstore                                                                                                      |
| Platform            |                                                   | ios                                                                                                           |
| Profile UUID        | sigh_com.mycompany.myapp1_appstore              | 11111111-1111-1111-1111-1111111111                                                                          |
| Profile Name        | sigh_com.mycompany.myapp1_appstore_profile-name | match AppStore com.mycompany.myapp1                                                                         |
| Profile Path        | sigh_com.mycompany.myapp1_appstore_profile-path | /Users/mycompany/Library/MobileDevice/Provisioning Profiles/11111111-1111-1111-1111-1111111111.mobileprovision |
| Development Team ID | sigh_com.mycompany.myapp1_appstore_team-id      | XXXXXXXXXX                                                                                                    |
+---------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------+


+---------------------+-------------------------------------------------+---------------------------------------------------------------------------------------------------------------+
|                                                                            �[32mInstalled Provisioning Profile�[0m                                                                             |
+---------------------+-------------------------------------------------+---------------------------------------------------------------------------------------------------------------+
| Parameter           | Environment Variable                            | Value                                                                                                         |
+---------------------+-------------------------------------------------+---------------------------------------------------------------------------------------------------------------+
| App Identifier      |                                                 | com.mycompany.myapp2                                                                                          |
| Type                |                                                 | appstore                                                                                                      |
| Platform            |                                                 | ios                                                                                                           |
| Profile UUID        | sigh_com.mycompany.myapp2_appstore              | 2222222-2222-2222-2222-2222222222                                                                          |
| Profile Name        | sigh_com.mycompany.myapp2_appstore_profile-name | match AppStore com.mycompany.myapp2                                                                           |
| Profile Path        | sigh_com.mycompany.myapp2_appstore_profile-path | /Users/mycompany/Library/MobileDevice/Provisioning Profiles/2222222-2222-2222-2222-2222222222.mobileprovision |
| Development Team ID | sigh_com.mycompany.myapp2_appstore_team-id      | XXXXXXXXXX                                                                                                    |
+---------------------+-------------------------------------------------+---------------------------------------------------------------------------------------------------------------+

So I am going to try to do this in the fastlane

cordova(
      platform: 'ios',
      provisioning_profile: ENV["sigh_" + ENV["APP_ID"] + "_appstore"]
    ) # Using the Cordova Fastlane Plugin

Or create an environment variable dynamically, will let you know if it works,

Looks like its not working.

[11:25:01]: �[31mfastlane finished with errors�[0m

Looking for related GitHub issues on fastlane/fastlane...

➡️  �[33mFastfile:3:in `+': [!] no implicit conversion of nil into String (TypeError)�[0m
    https://github.com/fastlane/fastlane/issues/9335 [�[32mclosed�[0m] 2 💬
    a week ago

➡️  �[33m[!] no implicit conversion of nil into String (TypeError) in Hockey acktion�[0m
    https://github.com/fastlane/fastlane/issues/9622 [�[32mclosed�[0m] 7 💬
    29 Jun 2017

➡️  �[33m"no implicit conversion of nil into String" in fastlane init�[0m
    https://github.com/fastlane/fastlane/issues/8083 [�[32mclosed�[0m] 5 💬
    12 Jul 2017

and 59 more at: https://github.com/fastlane/fastlane/search?q=no%20implicit%20conversion%20of%20nil%20into%20String&type=Issues&utf8=✓

Finally got it working:

I had to state the Provisioning Profile in cordova AND the app_identifier in testflight

  lane :beta do
    APP_ID = ("com.company.appProduction" if ENV["CI_COMMIT_REF_NAME"] == "master") || "com.company.appQA"
    APP_NAME = ("App Production" if ENV["CI_COMMIT_REF_NAME"] == "master") || "App QA"
    varName = "sigh_#{APP_ID}_appstore";
    unlock_keychain(
       path: "~/Library/Keychains/login.keychain-db"
    )
    match(
      type: "appstore",
      git_url: "git@XXX.XXX.XXX.XXX:url/certificates.git", # REPLACE WITH YOUR PRIVATE REPO FOR MATCH
      app_identifier: APP_ID
    )
    cordova(
      platform: 'ios',
      provisioning_profile: ENV[varName]      
    ) # Using the Cordova Fastlane Plugin
    set_info_plist_value(path: 'platforms/ios/' + APP_NAME + '/' + APP_NAME + '-Info.plist', key: "NSCameraUsageDescription", value: "This app requires camera access to function properly.")
    testflight(
      ipa: ENV['CORDOVA_IOS_RELEASE_BUILD_PATH'],
      app_identifier: APP_ID,
      skip_waiting_for_build_processing: true
    )
  end