Skip to content
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

Conversation

nilsreichardt
Copy link
Contributor

@nilsreichardt nilsreichardt commented Aug 26, 2023

Closes #339

Action app-store-connect publish can be used to upload iOS and macOS application packages (ipa and pkg 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 not PROCESSING any more. But behaviour for macOS apps is slightly different as beta details associated with the build might still be processed after that point. Hence BuildsActionGroup.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 usage
$ app-store-connect builds beta-details "3bf3e846-3d31-4e1e-ab0f-0834fb9f9a26"
Get Build Beta Details for Build 3bf3e846-3d31-4e1e-ab0f-0834fb9f9a26
-- Build Beta Detail --
Id: 3bf3e846-3d31-4e1e-ab0f-0834fb9f9a26
Type: buildBetaDetails
Auto notify enabled: True
External build state: EXPIRED
Internal build state: EXPIRED

Updated actions

  • app-store-connect publish

New actions

  • app-store-connect builds beta-details

@nilsreichardt
Copy link
Contributor Author

Unfortunately, does not work:

...

No errors uploading "Sharezone.pkg".

Find application entry from App Store Connect for uploaded binary
Found 1 App matching specified filters: bundleId=de.codingbrain.sharezone.app.
-- App --
Id: 1434868489

Type: apps
Bundle id: de.codingbrain.sharezone.app
Find uploaded build
Name: Sharezone - Schulplaner
Primary locale: de-DE
Sku: de.codingbrain.sharezone.app
Available in new territories: True
Content rights declaration: DOES_NOT_USE_THIRD_PARTY_CONTENT
Is or ever was made for kids: False

-- Build --
Uploaded build is
Id: c257b541-78c2-4cef-a41a-1ecd1e5cb0bf

Type: builds
Update beta build localization info in TestFlight for uploaded build
Expired: False
Icon asset token: 
	Template url: https://is4-ssl.mzstatic.com/image/thumb/Purple[126](https://github.com/SharezoneApp/sharezone-app/actions/runs/5986022160/job/16238714652#step:12:127)/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}
	Height: 167
	Width: 167
Min os version: 12.0
Processing state: VALID
Version: 470
Uses non exempt encryption: False
Uploaded date: 2023-08-21 11:44:25-07:00
Expiration date: 2023-11-19 11:44:25-08:00
Using application Sharezone - Schulplaner primary locale de-DE for beta build localization
Modify Beta Build Localization a72dbbe3-4907-4cd3-9106-6f6bffd62cbf
Successfully modified Beta Build Localization a72dbbe3-4907-4cd3-9106-6f6bffd62cbf
-- Beta Build Localization --
Id: a72dbbe3-4907-4cd3-9106-6f6bffd62cbf

Type: betaBuildLocalizations
Submit build 'c257b541-78c2-4cef-a41a-1ecd1e5cb0bf' to TestFlight beta review
Locale: de-DE
Whats new: Merge 98ac55c453f2442f9d692eb37a928ecbe2dd6d6e into e3c7ca68be1d310adb8408be4b34c61ced720e0b
Creating new Beta App Review Submission: build: c257b541-78c2-4cef-a41a-1ecd1e5cb0bf
POST https://api.appstoreconnect.apple.com/v1/betaAppReviewSubmissions returned 422: The build is not in a valid processing state for this operation. - The build is not in a valid processing state for this operation.
Failed to publish Sharezone.pkg

The build returned Processing state: VALID what seems to be wrong. Then the CLI tried to submit to TestFlight instantly without waiting to process the build.

Any ideas to fix this?

@priitlatt priitlatt self-requested a review September 4, 2023 06:55
@priitlatt
Copy link
Contributor

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.

@nilsreichardt
Copy link
Contributor Author

Hi @priitlatt, thanks for your review! Here are the logs:

$ app-store-connect builds get c257b541-78c2-4cef-a41a-1ecd1e5cb0bf --log-api-calls
Get Build c257b541-78c2-4cef-a41a-1ecd1e5cb0bf
>>> GET https://api.appstoreconnect.apple.com/v1/builds/c257b541-78c2-4cef-a41a-1ecd1e5cb0bf None
<<< 200 {'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': None, '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'}}, 'links': {'self': 'https://api.appstoreconnect.apple.com/v1/builds/c257b541-78c2-4cef-a41a-1ecd1e5cb0bf'}}
-- Build --
Id: c257b541-78c2-4cef-a41a-1ecd1e5cb0bf
Type: builds
Expired: False
Icon asset token: 
	Template url: 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}
	Height: 167
	Width: 167
Min os version: 12.0
Processing state: VALID
Version: 470
Uses non exempt encryption: False
Uploaded date: 2023-08-21 11:44:25-07:00
Expiration date: 2023-11-19 11:44:25-08:00

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"
		}
	}
}

@nilsreichardt
Copy link
Contributor Author

With my fix in 680427a it processes the build. However, I'm still getting an error when submitting for TestFlight:

POST https://api.appstoreconnect.apple.com/v1/betaAppReviewSubmissions returned 422: The build is not in state for internal testing. - Build is not in internal testing state.

Any ideas?

Full logs:

...

No errors uploading "Sharezone.pkg".

Find application entry from App Store Connect for uploaded binary
2023-09-04 16:40:18.635  INFO: [ContentDelivery.Uploader] COMPLETED - PART 2 - Sharezone.pkg - eTag: "59559975A7D28F[58](https://github.com/SharezoneApp/sharezone-app/actions/runs/6075795380/job/16482675989#step:12:59)65A305A8996B42B7"
2023-09-04 16:40:18.917  INFO: [ContentDelivery.Uploader] COMPLETED - PART 5 - Sharezone.pkg - eTag: "A66CF29CB0D9F243CEA831BB3C982086"
2023-09-04 16:40:18.939  INFO: [ContentDelivery.Uploader] COMPLETED - PART 6 - Sharezone.pkg - eTag: "6CDB8[59](https://github.com/SharezoneApp/sharezone-app/actions/runs/6075795380/job/16482675989#step:12:60)BD2ED712C56FEA1AEB71467CB"
2023-09-04 16:40:19.111  INFO: [ContentDelivery.Uploader] COMPLETED - PART 3 - Sharezone.pkg - eTag: "D9318105496305C3EDEE5064E040AA8C"
2023-09-04 16:40:19.288  INFO: [ContentDelivery.Uploader] COMPLETED - PART 9 - Sharezone.pkg - eTag: "1480EE6C971AAEC8322F4B93C9210C97"
2023-09-04 16:40:19.554  INFO: [ContentDelivery.Uploader] COMPLETED - PART 10 - Sharezone.pkg - eTag: "1B3AB719B646ABEC612D79FAAB5785A1"
2023-09-04 16:40:19.558  INFO: [ContentDelivery.Uploader] Time to transfer: 2.234 seconds (23444.39KB/s)
2023-09-04 16:40:20.822  INFO: [ContentDelivery.Uploader] 
================
UPLOAD SUCCEEDED
Delivery UUID: 4d5a1cad-1217-43b4-b284-b98f79b1fe4d
Transferred 52364914 bytes in 2.234 seconds (23.4MB/s)
================
{"tool-version":"6.315.14315","tool-path":"\/Applications\/Xcode_14.3.1.app\/Contents\/SharedFrameworks\/ContentDeliveryServices.framework\/Versions\/A\/Frameworks\/AppStoreService.framework","success-message":"No errors uploading 'Sharezone.pkg'","os-version":"13.5.1"}


Found 1 App matching specified filters: bundleId=de.codingbrain.sharezone.app.
-- App --
Id: 1434868489

Find uploaded build
Type: apps
Bundle id: de.codingbrain.sharezone.app
Name: Sharezone - Schulplaner
Primary locale: de-DE
Sku: de.codingbrain.sharezone.app
Available in new territories: True
Content rights declaration: DOES_NOT_USE_THIRD_PARTY_CONTENT
Is or ever was made for kids: False
Build has finished uploading but is processing on App Store Connect side. Could not find the build matching the uploaded version yet. Waiting 30 seconds to try again, 20 attempts remaining.
Build has finished uploading but is processing on App Store Connect side. Could not find the build matching the uploaded version yet. Waiting 30 seconds to try again, 19 attempts remaining.
Build has finished uploading but is processing on App Store Connect side. Could not find the build matching the uploaded version yet. Waiting 30 seconds to try again, 18 attempts remaining.
Build has finished uploading but is processing on App Store Connect side. Could not find the build matching the uploaded version yet. Waiting 30 seconds to try again, 17 attempts remaining.
Build has finished uploading but is processing on App Store Connect side. Could not find the build matching the uploaded version yet. Waiting 30 seconds to try again, 16 attempts remaining.
Build has finished uploading but is processing on App Store Connect side. Could not find the build matching the uploaded version yet. Waiting 30 seconds to try again, 15 attempts remaining.
Build has finished uploading but is processing on App Store Connect side. Could not find the build matching the uploaded version yet. Waiting 30 seconds to try again, 14 attempts remaining.
Build has finished uploading but is processing on App Store Connect side. Could not find the build matching the uploaded version yet. Waiting 30 seconds to try again, 13 attempts remaining.
Build has finished uploading but is processing on App Store Connect side. Could not find the build matching the uploaded version yet. Waiting 30 seconds to try again, 12 attempts remaining.
Build has finished uploading but is processing on App Store Connect side. Could not find the build matching the uploaded version yet. Waiting 30 seconds to try again, 11 attempts remaining.
Build has finished uploading but is processing on App Store Connect side. Could not find the build matching the uploaded version yet. Waiting 30 seconds to try again, 10 attempts remaining.
Build has finished uploading but is processing on App Store Connect side. Could not find the build matching the uploaded version yet. Waiting 30 seconds to try again, 9 attempts remaining.
Build has finished uploading but is processing on App Store Connect side. Could not find the build matching the uploaded version yet. Waiting 30 seconds to try again, 8 attempts remaining.
Build has finished uploading but is processing on App Store Connect side. Could not find the build matching the uploaded version yet. Waiting 30 seconds to try again, 7 attempts remaining.
Build has finished uploading but is processing on App Store Connect side. Could not find the build matching the uploaded version yet. Waiting 30 seconds to try again, 6 attempts remaining.

Uploaded build is
-- Build --
Id: 4d5a1cad-1217-43b4-b284-b98f79b1fe4d
Type: builds
Expired: False
Icon asset token: 
	Template url: https://is1-ssl.mzstatic.com/image/thumb/Purple116/v4/a6/f8/b7/a6f8b7c0-a80e-c152-02f9-45f136989459/AppIcon.icns/{w}x{h}bb.{f}
	Height: 256
	Width: 256
Min os version: 10.14
Processing state: VALID
Version: 483
Uses non exempt encryption: False
Uploaded date: 2023-09-04 09:47:53-07:00
Expiration date: 2023-12-03 09:47:53-08:00

Update beta build localization info in TestFlight for uploaded build
Using application Sharezone - Schulplaner primary locale de-DE for beta build localization
Modify Beta Build Localization 8adc0de8-8e[60](https://github.com/SharezoneApp/sharezone-app/actions/runs/6075795380/job/16482675989#step:12:61)-4b17-8e4c-75fe7b39d438
Successfully modified Beta Build Localization 8adc0de8-8e60-4b17-8e4c-75fe7b39d438
-- Beta Build Localization --
Id: 8adc0de8-8e60-4b17-8e4c-75fe7b39d438
Type: betaBuildLocalizations
Locale: de-DE
Whats new: Merge 4b3c4555c31b80d385dd2a3a9c1f7ad965bcb4fe into 51fcd6fd9[63](https://github.com/SharezoneApp/sharezone-app/actions/runs/6075795380/job/16482675989#step:12:64)1011cdd7f17cb2ffe208df1a92447

Submit build '4d5a1cad-1217-43b4-b284-b98f[79](https://github.com/SharezoneApp/sharezone-app/actions/runs/6075795380/job/16482675989#step:12:80)b1fe4d' to TestFlight beta review
Creating new Beta App Review Submission: build: 4d5a1cad-1217-43b4-b2[84](https://github.com/SharezoneApp/sharezone-app/actions/runs/6075795380/job/16482675989#step:12:85)-b[98](https://github.com/SharezoneApp/sharezone-app/actions/runs/6075795380/job/16482675989#step:12:99)f79b1fe4d
POST https://api.appstoreconnect.apple.com/v1/betaAppReviewSubmissions returned 422: The build is not in state for internal testing. - Build is not in internal testing state.
Failed to publish Sharezone.pkg
Error: Process completed with exit code 1.

@priitlatt
Copy link
Contributor

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?

@nilsreichardt
Copy link
Contributor Author

The App Store Connect UI says "Processing" while the CLI thought it has been processed.

App Store Connect UI:

Screenshot 2023-09-06 at 14 54 32

Logs:

image

When manually submitting the build to TestFlight, the changelog (what's new) was already filled out.

image

@priitlatt
Copy link
Contributor

The App Store Connect UI says "Processing" while the CLI thought it has been processed.

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.

@priitlatt
Copy link
Contributor

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.

@nilsreichardt
Copy link
Contributor Author

Cool, thanks! <3

@priitlatt
Copy link
Contributor

priitlatt commented Sep 7, 2023

@nilsreichardt Please include changes from #341 #343 to your PR and give it another go.

@nilsreichardt
Copy link
Contributor Author

@nilsreichardt Please include changes from #341 to your PR and give it another go.

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 🤞

@priitlatt
Copy link
Contributor

Of course, you are right, I meant #343. Sorry for the typo.

@nilsreichardt
Copy link
Contributor Author

Yes, that worked! 🎉

Logs:

image

Screenshot from App Store Connect (build number 489):

image

@nilsreichardt nilsreichardt marked this pull request as ready for review September 7, 2023 15:15
Comment on lines 209 to 215
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
Copy link
Contributor Author

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

Copy link
Contributor

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)

Copy link
Contributor Author

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 👍

@nilsreichardt
Copy link
Contributor Author

@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 👍

@priitlatt
Copy link
Contributor

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.

Copy link
Contributor

@priitlatt priitlatt left a 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.

Comment on lines 209 to 215
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
Copy link
Contributor

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)

@priitlatt priitlatt added the enhancement New feature or request label Sep 8, 2023
@nilsreichardt
Copy link
Contributor Author

If you don't mind I'll update the PR description myself to highlight all the things that were modified and added.

Yes, feel free to modify the PR description and code as you like 👍

Copy link
Contributor

@priitlatt priitlatt left a 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.

Copy link
Contributor Author

@nilsreichardt nilsreichardt left a 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.

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Show resolved Hide resolved
**Documentation**
- Add documentation for action `app-store-connect builds betat-details`.

Special thanks for contribution to [@nilsreichardt](https://github.com/nilsreichardt).
Copy link
Contributor Author

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>
@priitlatt
Copy link
Contributor

Just out of interested: Codemagic already supports publishing macOS apps to TestFlight?

I'm afraid something must have been lost in communication and the quoted statement is overly ambitious :|

@priitlatt priitlatt merged commit e1aab86 into codemagic-ci-cd:master Sep 8, 2023
@nilsreichardt
Copy link
Contributor Author

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 app-store-connect CLI 🤔 However, I think when this release becomes stable and the Codemagic machines update to the new CLI version it should support uploading macOS apps to TestFlight without changing anything (assuming that Codemagic doesn't block macOS uploads before using app-store-connect) 👍

github-merge-queue bot pushed a commit to SharezoneApp/sharezone-app that referenced this pull request Sep 8, 2023
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.
github-merge-queue bot pushed a commit to SharezoneApp/sharezone-app that referenced this pull request Sep 8, 2023
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for publishing macOS versions to TestFlight
2 participants