Build with a Specific Xcode Version in GitHub Actions macOS Image
What Was the Issue?
To upload an app to the App Store, I triggered a build workflow using GitHub Actions. However, during the archive job step, the following error occurred:
error: exportArchive: Validation failed. SDK version issue.
This app was built with the iOS 17.5 SDK. All iOS and iPadOS apps must be built with the iOS 18 SDK or later, included in Xcode 16 or later, in order to be uploaded to App Store Connect or submitted for distribution.
The validation failed because the app wasn’t built with Xcode 16 or later.
Cause
Until now, I had been specifying the build image for iOS as runs-on: macos-latest
and hadn’t given much thought to the Xcode version.
According to the official runner image repository, as of May 5, 2025, the image used for macos-latest
is macOS-14-arm64
:
Checking the software included in this image, Xcode 16 is indeed available, but the default version used is Xcode 15.4:
Solution
Since Xcode 16 is already included in the image, the issue can be resolved by explicitly specifying the Xcode version to use. I fixed the problem as follows:
runs-on: macos-latest
steps:
- name: Set Xcode version
run: sudo xcode-select -s /Applications/Xcode_16.2.app
With this configuration, Xcode 16.2 is used in the workflow, allowing the build to be archived and successfully uploaded to the App Store.
Conclusion
Explicitly specifying the Xcode version resolved the error. However, if Apple updates the minimum required Xcode version for the App Store again, the workflow will need to be updated accordingly.
It would be ideal if the default Xcode version in the official runner image were updated in a timely manner, but I wonder if there’s a better approach.