I'm attempting to build and deploy an iOS app to TestFlight using Fastlane and GitHub Actions.
Here's the issue I'm encountering:
Local Success: When running Fastlane commands directly in my Terminal, the build and deployment to TestFlight succeed.
GitHub Actions Issue: In my GitHub Actions workflow, the process proceeds smoothly until the gym step. At this point, I encounter errors (please see the error output below).
Resolved source packages
[14:07:49]: ▸ swift-collections - https://github.com/apple/swift-collections @ 1.0.6
[14:07:49]: ▸ swift-log - https://github.com/apple/swift-log.git @ 1.5.4
[14:07:49]: ▸ aws-sdk-swift - https://github.com/awslabs/aws-sdk-swift.git @ 0.31.0
[14:07:49]: ▸ Starscream - https://github.com/daltoniam/Starscream @ 4.0.4
[14:07:49]: ▸ AmplifyUtilsNotifications - https://github.com/aws-amplify/amplify-swift-utils-notifications.git @ 1.1.1
[14:07:49]: ▸ SQLite.swift - https://github.com/stephencelis/SQLite.swift.git @ 0.13.2
[14:07:49]: ▸ XMLCoder - https://github.com/MaxDesiatov/XMLCoder.git @ 0.17.0
[14:07:49]: ▸ AmplifyUILiveness - https://github.com/aws-amplify/amplify-ui-swift-liveness @ 1.2.2
[14:07:49]: ▸ Amplify - https://github.com/aws-amplify/amplify-swift @ 2.25.5
[14:07:49]: ▸ AppSyncRealTimeClient - https://github.com/aws-amplify/aws-appsync-realtime-client-ios.git @ 3.1.2
[14:07:49]: ▸ smithy-swift - https://github.com/smithy-lang/smithy-swift @ 0.35.0
[14:07:49]: ▸ aws-crt-swift - https://github.com/awslabs/aws-crt-swift @ 0.17.0
[14:07:57]: ▸ 2024-02-27 14:07:57.243 xcodebuild[14923:43414] [MT] IDEFileReferenceDebug: [Load] <IDESwiftPackageCore.IDESwiftPackageSpecialFolderFileReference, 0x600005cd1b00: name:Docs.docc path:group:Docs.docc> Failed to load container at path: /Users/runner/Library/Developer/Xcode/DerivedData/Runner-bvhnnwsbqawhdsazvgxqinopppxn/SourcePackages/checkouts/swift-log/Sources/Logging/Docs.docc, Error: Error Domain=com.apple.dt.IDEContainerErrorDomain Code=6 "Cannot open "Docs.docc" as a "Swift Package Folder" because it is already open as a "Folder"." UserInfo={NSLocalizedDescription=Cannot open "Docs.docc" as a "Swift Package Folder" because it is already open as a "Folder".}
[14:07:57]: ▸ 2024-02-27 14:07:57.361 xcodebuild[14923:43414] [MT] IDEFileReferenceDebug: [Load] <IDESwiftPackageCore.IDESwiftPackageSpecialFolderFileReference, 0x600005c3bf00: name:OrderedCollections.docc path:group:OrderedCollections.docc> Failed to load container at path: /Users/runner/Library/Developer/Xcode/DerivedData/Runner-bvhnnwsbqawhdsazvgxqinopppxn/SourcePackages/checkouts/swift-collections/Sources/OrderedCollections/OrderedCollections.docc, Error: Error Domain=com.apple.dt.IDEContainerErrorDomain Code=6 "Cannot open "OrderedCollections.docc" as a "Swift Package Folder" because it is already open as a "Folder"." UserInfo={NSLocalizedDescription=Cannot open "OrderedCollections.docc" as a "Swift Package Folder" because it is already open as a "Folder".}
[14:07:57]: ▸ 2024-02-27 14:07:57.366 xcodebuild[14923:43414] [MT] IDEFileReferenceDebug: [Load] <IDESwiftPackageCore.IDESwiftPackageSpecialFolderFileReference, 0x600005ce9400: name:DequeModule.docc path:group:DequeModule.docc> Failed to load container at path: /Users/runner/Library/Developer/Xcode/DerivedData/Runner-bvhnnwsbqawhdsazvgxqinopppxn/SourcePackages/checkouts/swift-collections/Sources/DequeModule/DequeModule.docc, Error: Error Domain=com.apple.dt.IDEContainerErrorDomain Code=6 "Cannot open "DequeModule.docc" as a "Swift Package Folder" because it is already open as a "Folder"." UserInfo={NSLocalizedDescription=Cannot open "DequeModule.docc" as a "Swift Package Folder" because it is already open as a "Folder".}
[14:07:57]: ▸ 2024-02-27 14:07:57.372 xcodebuild[14923:43414] [MT] IDEFileReferenceDebug: [Load] <IDESwiftPackageCore.IDESwiftPackageSpecialFolderFileReference, 0x600005cea100: name:Collections.docc path:group:Collections.docc> Failed to load container at path: /Users/runner/Library/Developer/Xcode/DerivedData/Runner-bvhnnwsbqawhdsazvgxqinopppxn/SourcePackages/checkouts/swift-collections/Sources/Collections/Collections.docc, Error: Error Domain=com.apple.dt.IDEContainerErrorDomain Code=6 "Cannot open "Collections.docc" as a "Swift Package Folder" because it is already open as a "Folder"." UserInfo={NSLocalizedDescription=Cannot open "Collections.docc" as a "Swift Package Folder" because it is already open as a "Folder".}
[14:08:05]: ▸ ::error file=/Users/runner/work/app/app/ios/Flutter/Release.xcconfig,line=2,col=1::could not find included file 'Generated.xcconfig' in search paths
[14:08:05]: ▸ /Users/runner/work/app/app/ios/Flutter/Release.xcconfig:2:1: error: could not find included file 'Generated.xcconfig' in search paths
[14:08:05]: ▸ /Users/runner/work/app/app/ios/Flutter/Release.xcconfig:2:1: error: could not find included file 'Generated.xcconfig' in search paths
[14:08:05]: ▸ ::warning ::Unable to read contents of XCFileList '/Target Support Files/Pods-Runner/Pods-Runner-frameworks-Release-output-files.xcfilelist' (in target 'Runner' from project 'Runner')
[14:08:05]: ▸ ::error ::error: Unable to load contents of file list: '/Target Support Files/Pods-Runner/Pods-Runner-frameworks-Release-input-files.xcfilelist' (in target 'Runner' from project 'Runner')
[14:08:05]: ▸ ::error ::error: Unable to load contents of file list: '/Target Support Files/Pods-Runner/Pods-Runner-frameworks-Release-output-files.xcfilelist' (in target 'Runner' from project 'Runner')
[14:08:05]: ▸ ::warning ::Run script build phase '[CP] Embed Pods Frameworks' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
[14:08:05]: ▸ ** ARCHIVE FAILED **
Build environment
fastlane summary
And here is my Git Actions For Flutter Ios:
name: iOS TestFlight Deployment
on:
push:
branches: [feature/ios_fastlane_setup]
jobs:
build-and-deploy-ios:
runs-on: macos-latest
steps:
- name: Set up git and fetch all history for all branches and tags
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "2.7"
- name: List files in iOS Runner directory
run: ls -la ${{ github.workspace }}/ios/Runner
- name: Bundle install for iOS Gemfile
timeout-minutes: 5
run: |
cd ${{ github.workspace }}/ios
bundle install --path vendor/bundle
- name: Set up Flutter SDK
uses: subosito/flutter-action@v2
with:
flutter-version: "3.16.2"
channel: "stable"
architecture: x64
cache: true
- name: Install Fastlane
run: |
flutter clean
flutter build
env:
APP_STORE_CONNECT_TEAM_ID: "${{ secrets.APP_STORE_CONNECT_TEAM_ID }}"
DEVELOPER_APP_ID: "${{ secrets.DEVELOPER_APP_ID }}"
DEVELOPER_APP_IDENTIFIER: "${{ secrets.DEVELOPER_APP_IDENTIFIER }}"
DEVELOPER_PORTAL_TEAM_ID: "${{ secrets.DEVELOPER_PORTAL_TEAM_ID }}"
FASTLANE_APPLE_ID: "${{ secrets.FASTLANE_APPLE_ID }}"
FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: "${{ secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD }}"
MATCH_PASSWORD: "${{ secrets.MATCH_PASSWORD }}"
GIT_AUTHORIZATION: "${{ secrets.GIT_AUTHORIZATION }}"
PROVISIONING_PROFILE_SPECIFIER: "${{ secrets.PROVISIONING_PROFILE_SPECIFIER }}"
TEMP_KEYCHAIN_PASSWORD: "${{ secrets.TEMP_KEYCHAIN_PASSWORD }}"
TEMP_KEYCHAIN_USER: "${{ secrets.TEMP_KEYCHAIN_USER }}"
APPLE_KEY_ID: "${{ secrets.APPLE_KEY_ID }}"
APPLE_ISSUER_ID: "${{ secrets.APPLE_ISSUER_ID }}"
APPLE_KEY_CONTENT: "${{ secrets.APPLE_KEY_CONTENT }}"
- name: Deploy iOS Beta to TestFlight via Fastlane
uses: maierj/[email protected]
with:
lane: "closed_beta"
subdirectory: "ios"
And my Fastlane code:
default_platform(:ios)
ENV["FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT"] = "120"
DEVELOPER_APP_ID = ENV["DEVELOPER_APP_ID"]
DEVELOPER_APP_IDENTIFIER = ENV["DEVELOPER_APP_IDENTIFIER"]
PROVISIONING_PROFILE_SPECIFIER = ENV["PROVISIONING_PROFILE_SPECIFIER"]
TEMP_KEYCHAIN_USER = ENV["TEMP_KEYCHAIN_USER"]
TEMP_KEYCHAIN_PASSWORD = ENV["TEMP_KEYCHAIN_PASSWORD"]
APPLE_ISSUER_ID = ENV["APPLE_ISSUER_ID"]
APPLE_KEY_ID = ENV["APPLE_KEY_ID"]
APPLE_KEY_CONTENT = ENV["APPLE_KEY_CONTENT"]
GIT_AUTHORIZATION = ENV["GIT_AUTHORIZATION"]
FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT=ENV["FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT"] = "120"
# ENV['ITMSTRANSPORTER_FORCE_ITMS_PACKAGE_UPLOAD'] = 'true'
def delete_temp_keychain(name)
delete_keychain(
name: name
) if File.exist? File.expand_path("~/Library/Keychains/#{name}-db")
end
def create_temp_keychain(name, password)
create_keychain(
name: name,
password: password,
unlock: false,
timeout: 0
)
end
def ensure_temp_keychain(name, password)
delete_temp_keychain(name)
create_temp_keychain(name, password)
end
platform :ios do
lane :closed_beta do
keychain_name = TEMP_KEYCHAIN_USER
keychain_password = TEMP_KEYCHAIN_PASSWORD
ensure_temp_keychain(keychain_name, keychain_password)
api_key = app_store_connect_api_key(
key_id: APPLE_KEY_ID,
issuer_id: APPLE_ISSUER_ID,
key_content: APPLE_KEY_CONTENT,
duration: 1200,
in_house: false
)
increment_build_number(xcodeproj: "Runner.xcodeproj")
match(
type: 'appstore',
app_identifier: "#{DEVELOPER_APP_IDENTIFIER}",
git_basic_authorization: Base64.strict_encode64(GIT_AUTHORIZATION),
readonly: true,
keychain_name: keychain_name,
keychain_password: keychain_password,
api_key: api_key
)
# Build the App
gym(
configuration: "Release",
workspace: "Runner.xcworkspace",
scheme: "Runner",
export_method: "app-store",
export_options: {
provisioningProfiles: {
DEVELOPER_APP_ID => PROVISIONING_PROFILE_SPECIFIER
}
}
)
pilot(
apple_id: "#{DEVELOPER_APP_ID}",
app_identifier: "#{DEVELOPER_APP_IDENTIFIER}",
skip_waiting_for_build_processing: true,
skip_submission: true,
distribute_external: false,
notify_external_testers: false,
ipa: "./ozqr.ipa"
)
delete_temp_keychain(keychain_name)
end
end


