yukiarrr / ios-build-action

Build iOS project (.xcodeproj, .xcworkspace), and export ipa
MIT License
279 stars 135 forks source link

How to debug ? #42

Open jerome-morgado opened 3 years ago

jerome-morgado commented 3 years ago

Hi,

I have this issue :

51 [13:01:45]: ------------------------------------------
52 [13:01:45]: --- Step: install_provisioning_profile ---
53 [13:01:45]: ------------------------------------------
54 [13:01:45]: Installing provisioning profile...
55 [13:01:45]: Failure to decode /Users/runner/work/digitalsite2d/site2d/ios-build-1.mobileprovision. Exit: 1: security: cert import failed: unknown error -1=ffffffffffffffff

How can I debug ? How to be sure that mobileprovision and certs are correct ? Is it possible to list the names (not the content) to be sure ?

ibrandis commented 3 years ago

I am having a somewhat similar issue; did you manage to resolve yours?

[10:09:39]: ------------------------------------------
[10:09:39]: --- Step: install_provisioning_profile ---
[10:09:39]: ------------------------------------------
[10:09:39]: Installing provisioning profile...
[10:09:39]: Failure to decode /Users/runner/work/iosCICD/iosCICD/ios-build-1.mobileprovision. Exit: 1: security: failed to decode message: UNKNOWN (-8183(d)

Update: That error was resolved for me. My prob was in how I copied the base64 encoded profile from my machine.

jerome-morgado commented 3 years ago

I copied this mobile profile base64 encoded on GitHub secrets because the env var is named mobileprovision-base64 Shall I use the mobileprovision-base64 env with a non-encoded content ?

Maybe it would be great if we have more debug on the content sent from the user. Just to be sure that the content is well set.

Regards

ibrandis commented 3 years ago

Mine worked with base64 encoded. I just made sure I copied the whole thing. not just cat it to screen. I opened the encoded file in a text file and copied it to the secrets. that way I made sure I copied the whole thing

jerome-morgado commented 3 years ago

Ok, il did it in my terminal cat /Path/to/file.mobileprovision | base64 | pbcopy

yukiarrr commented 3 years ago

Sorry for the late response. @ibrandis Thanks for the solution!

How to debug

  1. Place the fastlane folder of ios-build-action in your iOS project directory.
  2. Set the environment variables as described here.
  3. If you have already imported the certificate to your Mac, remove the code here.
  4. Run fastlane export_ipa in your terminal.
jerome-morgado commented 3 years ago

How to be sure that env are well set ?

I made a script tu build :

#/bin/bash

export P12_KEY_BASE64="MIIM...........AQE=";
export CERTIFICATE_PASSWORD="Xxxxxx";
export MOBILEPROVISION_BASE64="MIIc.....Oubs=";
export PROJECT_PATH="MyProject.xcodeproj";
export CODE_SIGNING_IDENTITY="iPhone Distribution";
export TEAM_ID="Team Name";
export WORKSPACE_PATH="MyProject.xcodeproj/project.xcworkspace";
export SCHEME="MyProject";
export UPDATE_TARGETS="MyProject";
export DISABLE_TARGETS="MyProject preprod,MyProject dev,MyProject qa,MyProjectUITest";

env // This is to show env

## RUN FASTLANE
fastlane ios export_ipa

And I have this issue :

[11:09:38]: Error in your Fastfile at line 180
[11:09:38]:     178:      def decode_file
[11:09:38]:     179:        @is_split_cer =
[11:09:38]:  => 180:          !ENV['P12_KEY_BASE64'].empty? && !ENV['P12_CER_BASE64'].empty?
[11:09:38]:     181:        if @is_split_cer
[11:09:38]:     182:          File.write('../ios-build-key.p12', Base64.decode64(ENV['P12_KEY_BASE64']))

I think we really need a Working Example with a Fake project (Fake Name, Fake Keys, Fake Team) but with screenshots explain g. And why not a script to make a test locally (D/L fast lane, and build script )

We can't debug easily, make breakpoints or display info during the build.

Regards.

yukiarrr commented 3 years ago

Sorry for the late response. You need to set an empty string even for environment variables that you are not using. For more information about environment variables, please click here.

tdolotkazin commented 3 years ago

If you have already imported the certificate to your Mac, remove the code here.

I believe that this code should be removed anyway. Cause it somehow replaced my 'login' keychain with 'ios-build' and I have no password. @yukiarrr is it normal behaviour?

Screenshot 2021-04-14 at 23 58 24
stetxo commented 2 years ago

If you have already imported the certificate to your Mac, remove the code here.

Cause it somehow replaced my 'login' keychain with 'ios-build' and I have no password. @yukiarrr is it normal behaviour? Screenshot 2021-04-14 at 23 58 24

Confirm, I bumped into the same behaviour.