-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for publishing macOS builds to TestFlight and App Store #340
Add support for publishing macOS builds to TestFlight and App Store #340
Conversation
Unfortunately, does not work:
The build returned Any ideas to fix this? |
Hi @nilsreichardt, in principle the changes you've proposed look good, but perhaps there is something with the build that we fail to see. Could you please share the output of app-store-connect builds get c257b541-78c2-4cef-a41a-1ecd1e5cb0bf --log-api-calls with me so that I could see all the details of said build. |
Hi @priitlatt, thanks for your review! Here are the logs:
Here is the JSON from the logs in a formatted format: {
"data": {
"type": "builds",
"id": "c257b541-78c2-4cef-a41a-1ecd1e5cb0bf",
"attributes": {
"version": "470",
"uploadedDate": "2023-08-21T11:44:25-07:00",
"expirationDate": "2023-11-19T11:44:25-08:00",
"expired": false,
"minOsVersion": "12.0",
"lsMinimumSystemVersion": null,
"computedMinMacOsVersion": "11.0",
"computedMinVisionOsVersion": "1.0",
"computedMinRealityOsVersion": "1.0",
"iconAssetToken": {
"templateUrl": "https://is4-ssl.mzstatic.com/image/thumb/Purple126/v4/94/e0/8b/94e08b87-4f9d-fd29-797c-87ea3f30ef1b/AppIcon-0-0-2x_U007epad-0-0-0-8-0-0-sRGB-0-0-0-GLES2_U002c0-512MB-85-220-0-0.png/{w}x{h}bb.{f}",
"width": 167,
"height": 167
},
"processingState": "VALID",
"buildAudienceType": "APP_STORE_ELIGIBLE",
"usesNonExemptEncryption": false
},
"relationships": {
"preReleaseVersion": {
"links": {
"self": "https://api.appstoreconnect.apple.com/v1/builds/c257b541-78c2-4cef-a41a-1ecd1e5cb0bf/relationships/preReleaseVersion",
"related": "https://api.appstoreconnect.apple.com/v1/builds/c257b541-78c2-4cef-a41a-1ecd1e5cb0bf/preReleaseVersion"
}
},
"individualTesters": {
"links": {
"self": "https://api.appstoreconnect.apple.com/v1/builds/c257b541-78c2-4cef-a41a-1ecd1e5cb0bf/relationships/individualTesters",
"related": "https://api.appstoreconnect.apple.com/v1/builds/c257b541-78c2-4cef-a41a-1ecd1e5cb0bf/individualTesters"
}
},
"betaGroups": {
"links": {
"self": "https://api.appstoreconnect.apple.com/v1/builds/c257b541-78c2-4cef-a41a-1ecd1e5cb0bf/relationships/betaGroups"
}
},
"betaBuildLocalizations": {
"links": {
"self": "https://api.appstoreconnect.apple.com/v1/builds/c257b541-78c2-4cef-a41a-1ecd1e5cb0bf/relationships/betaBuildLocalizations",
"related": "https://api.appstoreconnect.apple.com/v1/builds/c257b541-78c2-4cef-a41a-1ecd1e5cb0bf/betaBuildLocalizations"
}
},
"appEncryptionDeclaration": {
"links": {
"self": "https://api.appstoreconnect.apple.com/v1/builds/c257b541-78c2-4cef-a41a-1ecd1e5cb0bf/relationships/appEncryptionDeclaration",
"related": "https://api.appstoreconnect.apple.com/v1/builds/c257b541-78c2-4cef-a41a-1ecd1e5cb0bf/appEncryptionDeclaration"
}
},
"betaAppReviewSubmission": {
"links": {
"self": "https://api.appstoreconnect.apple.com/v1/builds/c257b541-78c2-4cef-a41a-1ecd1e5cb0bf/relationships/betaAppReviewSubmission",
"related": "https://api.appstoreconnect.apple.com/v1/builds/c257b541-78c2-4cef-a41a-1ecd1e5cb0bf/betaAppReviewSubmission"
}
},
"app": {
"links": {
"self": "https://api.appstoreconnect.apple.com/v1/builds/c257b541-78c2-4cef-a41a-1ecd1e5cb0bf/relationships/app",
"related": "https://api.appstoreconnect.apple.com/v1/builds/c257b541-78c2-4cef-a41a-1ecd1e5cb0bf/app"
}
},
"buildBetaDetail": {
"links": {
"self": "https://api.appstoreconnect.apple.com/v1/builds/c257b541-78c2-4cef-a41a-1ecd1e5cb0bf/relationships/buildBetaDetail",
"related": "https://api.appstoreconnect.apple.com/v1/builds/c257b541-78c2-4cef-a41a-1ecd1e5cb0bf/buildBetaDetail"
}
},
"appStoreVersion": {
"links": {
"self": "https://api.appstoreconnect.apple.com/v1/builds/c257b541-78c2-4cef-a41a-1ecd1e5cb0bf/relationships/appStoreVersion",
"related": "https://api.appstoreconnect.apple.com/v1/builds/c257b541-78c2-4cef-a41a-1ecd1e5cb0bf/appStoreVersion"
}
},
"icons": {
"links": {
"self": "https://api.appstoreconnect.apple.com/v1/builds/c257b541-78c2-4cef-a41a-1ecd1e5cb0bf/relationships/icons",
"related": "https://api.appstoreconnect.apple.com/v1/builds/c257b541-78c2-4cef-a41a-1ecd1e5cb0bf/icons"
}
},
"perfPowerMetrics": {
"links": {
"related": "https://api.appstoreconnect.apple.com/v1/builds/c257b541-78c2-4cef-a41a-1ecd1e5cb0bf/perfPowerMetrics"
}
},
"diagnosticSignatures": {
"links": {
"self": "https://api.appstoreconnect.apple.com/v1/builds/c257b541-78c2-4cef-a41a-1ecd1e5cb0bf/relationships/diagnosticSignatures",
"related": "https://api.appstoreconnect.apple.com/v1/builds/c257b541-78c2-4cef-a41a-1ecd1e5cb0bf/diagnosticSignatures"
}
}
},
"links": {
"self": "https://api.appstoreconnect.apple.com/v1/builds/c257b541-78c2-4cef-a41a-1ecd1e5cb0bf"
}
}
} |
With my fix in 680427a it processes the build. However, I'm still getting an error when submitting for TestFlight:
Any ideas? Full logs:
|
Now this looks very similar to what is described in this (rather old) Fastlane issue: fastlane/fastlane#14033, that sadly has no resolution whatsoever. From a more recent time, this thread on Apple Developer Forum looks somewhat related. But this too does not have any answers either. What does App Store Connect UI tell you about this specific build? Maybe there are some hints there? |
This is some great intel! I'll try to reproduce this on my end here and get back to you as soon as I have something or need further details from you. |
I managed to reproduce the exact same result - API response reports that build is already processed, but in UI (and in practice I presume) it is still shown as processing. I'll try to come up with some additional checks that could be used to ensure that the processing is truly completed. |
Cool, thanks! <3 |
@nilsreichardt Please include changes from |
Thanks! I mean #343, right? :D I started a new build: https://github.com/SharezoneApp/sharezone-app/actions/runs/6111211832/job/16585932191?pr=827. Let's see 🤞 |
Of course, you are right, I meant #343. Sorry for the typo. |
if isinstance(application_package, MacOsPackage): | ||
platform = Platform.MAC_OS | ||
else: | ||
platform = Platform.IOS | ||
if application_package.is_for_tvos(): | ||
platform = Platform.TV_OS | ||
else: | ||
platform = Platform.IOS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is the correct behaviour
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In principle this is correct, but I presume that it would be better to extract the logic into a separate method now. For example
@staticmethod
def _get_application_package_platform(application_package: Union[Ipa, MacOsPackage]) -> Platform:
if isinstance(application_package, MacOsPackage):
return Platform.MAC_OS
if application_package.is_for_tvos():
return Platform.TV_OS
return Platform.IOS
and here you could just do
if not platform:
platform = cls._get_application_package_platform(application_package)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that sounds good! I extracted the logic into a separated method in 08ef364 👍
@priitlatt Let me know, if should change something 👍 Btw: props for the code quality, I could easily understand and modify the code without knowing how to write Python code 👍 |
First and foremost, thanks for the contribution! I'll take another look at it tomorrow and let you know if there is anything else that needs to be changed, or we can move on with release procedure. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nilsreichardt, apart from one very tiny remark everything looks good.
If you don't mind I'll update the PR description myself to highlight all the things that were modified and added.
if isinstance(application_package, MacOsPackage): | ||
platform = Platform.MAC_OS | ||
else: | ||
platform = Platform.IOS | ||
if application_package.is_for_tvos(): | ||
platform = Platform.TV_OS | ||
else: | ||
platform = Platform.IOS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In principle this is correct, but I presume that it would be better to extract the logic into a separate method now. For example
@staticmethod
def _get_application_package_platform(application_package: Union[Ipa, MacOsPackage]) -> Platform:
if isinstance(application_package, MacOsPackage):
return Platform.MAC_OS
if application_package.is_for_tvos():
return Platform.TV_OS
return Platform.IOS
and here you could just do
if not platform:
platform = cls._get_application_package_platform(application_package)
Yes, feel free to modify the PR description and code as you like 👍 |
…d-support-for-publishing-macos-to-testflight-and-app-store
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, everything looks good to me now. @nilsreichardt, if you don't have any objections, then I'll merge and release it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides the typo, LGTM 🚀
Thanks for great documentation (+ PR description) and helping me to implement this feature ❤️
Just out of interested: Codemagic already supports publishing macOS apps to TestFlight? 🤔 This says the docs for publishing to App Store Connect:
Codemagic enables you to automatically publish your iOS or macOS app to App Store Connect for beta testing with TestFlight or distributing the app to users via App Store.
**Documentation** | ||
- Add documentation for action `app-store-connect builds betat-details`. | ||
|
||
Special thanks for contribution to [@nilsreichardt](https://github.com/nilsreichardt). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
Co-authored-by: Nils Reichardt <me@nils.re>
I'm afraid something must have been lost in communication and the quoted statement is overly ambitious :| |
Yeah, I was wondering that too, because if Codemagic already supported this, they would have to use something other than the |
Uploading the alpha version to App Store Connect worked. However, publishing the version to TestFlight has not worked. The reason: Codemagic CLI Tools didn't support this feature yet. Therefore, I implemented it in the `app-store-connect` CLI: * codemagic-ci-cd/cli-tools#340 The PR codemagic-ci-cd/cli-tools#340 is included in the `0.43.0` version (see [changelog](https://github.com/codemagic-ci-cd/cli-tools/releases/tag/v0.43.0)). I upgraded the version of the Codemagic CLI Tools to `0.43.0` to support this feature. Even when I would only need to upgrade `stabe.yml` and `alpha.yml` I upgraded all workflows that use the Codemagic CLI tools to have the newest version.
Uploading the alpha version to App Store Connect worked. However, publishing the version to TestFlight has not worked. The reason: Codemagic CLI Tools didn't support this feature yet. Therefore, I implemented it in the `app-store-connect` CLI: * codemagic-ci-cd/cli-tools#340 The PR codemagic-ci-cd/cli-tools#340 is included in the `0.43.0` version (see [changelog](https://github.com/codemagic-ci-cd/cli-tools/releases/tag/v0.43.0)). I upgraded the version of the Codemagic CLI Tools to `0.43.0` to support this feature. Even when I would only need to upgrade `stabe.yml` and `alpha.yml` I upgraded all workflows that use the Codemagic CLI tools to have the newest version.
Closes #339
Action
app-store-connect publish
can be used to upload iOS and macOS application packages (ipa
andpkg
files respectively) to App Store Connect. At the time of initial implementation, TestFlight beta distribution was not supported for macOS applications and as such using--testflight
option when publishing macOS packages is just ignored and has no effect.Changes proposed here remove this limitation as TestFlight beta distribution for macOS apps has been supported for quite some time already. However, as Apple's processing procedure of macOS packages differs slightly from iOS packages, it became necessary to also modify the method that waits until build processing completes. For iOS it will suffice to just wait until build's
processingState
attribute is notPROCESSING
any more. But behaviour for macOS apps is slightly different as beta details associated with the build might still be processed after that point. HenceBuildsActionGroup.wait_until_build_is_processed
was updated to accommodate that.Necessary App Store Connect API client method and object mappings for dealing with BuildBetaDetail were added along with new action to show beta detail info for given build:
app-store-connect builds beta-details
usageUpdated actions
app-store-connect publish
New actions
app-store-connect builds beta-details