Reputation: 61
I am new in implementing fastlane with guthub actions and tried to make the ios build automate.
Steps which I followed.
Note: I haven't used fastlane match action, Trying to achieve without match.
Issue: Triggered github workflow action, then getting error in Fastfile 'build_app' action. Clean Succeeded, ** ARCHIVE FAILED **
Error: No certificate for team 'XXXXX' matching 'Apple Distribution: COMPANY_NAME (XXXXX)' found: Select a different signing certificate for CODE_SIGN_IDENTITY, a team that matches your selected certificate, or switch to automatic provisioning. (in target 'Runner' from project 'Runner')
Fastlane code:
build_app(
workspace: "Runner.xcworkspace",
scheme: scheme_name,
clean: true,
export_method: "app-store",
export_options: {
provisioningProfiles: {
app_bundle_identifier => provisioning_profile_name
}
},
codesigning_identity: "Apple Distribution: COMPANY_NAME (XXXXX)"
)
GitHub action code:
# Install certificate
- name: Install certificate
env:
IOS_CERTIFICATE_P12_FILE_CONTENT: ${{ secrets.IOS_CERTIFICATE_P12 }}
IOS_CERTIFICATE_PASSWORD: ${{ secrets.IOS_CERTIFICATE_PASSWORD }}
run: |
mkdir -p ~/certificates
echo "$IOS_CERTIFICATE_P12_FILE_CONTENT" | base64 --decode > ~/certificates/"Apple Distribution: COMPANY_NAME (XXXXX).p12"
security create-keychain -p "xxxxx" /tmp/my.keychain
security unlock-keychain -p "xxxxx" /tmp/my.keychain
security set-keychain-settings /tmp/my.keychain
security import ~/certificates/"Apple Distribution: COMPANY_NAME (XXXXX).p12" -k /tmp/my.keychain -P "$IOS_CERTIFICATE_PASSWORD" -A
security list-keychains -d user
security find-identity -v -p codesigning /tmp/my.keychain
# Setting up provisioning profiles
- name: Set up provisioning profiles
run: |
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp ${{ github.workspace }}/ios/fastlane/provisioning/SQA_Profile.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/SQA_Profile.mobileprovision
# Trigger fastlane to build ios
- name: Build & Publish to TestFlight with Fastlane
run: cd ios && bundle exec fastlane ${{ github.event.inputs.lane }}
Note: I have exported the distribution certificate from My Macbook keychain as .p12 format, and encoded the content of certificate to store in Github secrets.
Can someone help how to resolve this error.
Upvotes: 1
Views: 7081
Reputation: 351
Try adding the TEAM ID in the export_options of the build_app action.
TEAM_ID = ENV["APPLE_TEAM_ID"]
[ ... ]
build_app(
workspace: "Runner.xcworkspace",
scheme: scheme_name,
clean: true,
export_method: "app-store",
export_options: {
teamID: TEAM_ID,
provisioningProfiles: {
app_bundle_identifier => provisioning_profile_name
}
},
codesigning_identity: "Apple Distribution: COMPANY_NAME (XXXXX)"
)
Team ID can be found under https://developer.apple.com/account in the Membership Details section.
If this is not the cause of your problem maybe you can play around Match. I really like that setup because I have a git repo for my team in which we keep the certificates to easily share between everybody, and the Match action will automate everything for you.
Ive also had a lot of headache setting up certificates in my runner(GitlabCI) in the past, so I stumbled across https://docs.fastlane.tools/actions/setup_ci/, which just magically setup the keychain for me.
Hope this helps somehow. Cheers!
Upvotes: 0