Skip to content

Commit

Permalink
Add new and improve existing app-store-connect actions (#380)
Browse files Browse the repository at this point in the history
  • Loading branch information
priitlatt authored Dec 11, 2023
1 parent 39d4c62 commit a3688de
Show file tree
Hide file tree
Showing 29 changed files with 681 additions and 51 deletions.
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
Version 0.48.0
-------------

This PR contains changes from [PR #380](https://github.com/codemagic-ci-cd/cli-tools/pull/380)

**Features**
- Add new actions:
- `app-store-connect app-store-versions get` to show App Store Version information. See official API method [documentation](https://developer.apple.com/documentation/appstoreconnectapi/read_app_store_version_information).
- `app-store-connect review-submission-items delete` to remove existing review submission item from App Store Connect. See official API method [documentation](https://developer.apple.com/documentation/appstoreconnectapi/delete_v1_reviewsubmissionitems_id).
- `app-store-connect review-submissions items` to list review submission items of specified review submission. See official API method [documentation](https://developer.apple.com/documentation/appstoreconnectapi/list_the_items_in_a_review_submission).
- Add option `--locale` to action `app-store-connect app-store-versions localizations` to filter retrieved localizations by given specified locales.
- Improve error message for action `app-store-connect review-submission-items create` if creating review submission item fails because required values are missing for application default locale on respective App Store Version.

**Bugfixes**
- Fix invoking action `app-store-connect review-submission-items create` from command line.
- Do not require device IDs for action `app-store-connect create-profile` when not creating development or Ad Hoc provisioning profiles.

**Development**
- Add new module `codemagic.utilities.case_conversion` with public functions `snake_to_camel` and `camel_to_snake`.
- Add new client method `list_items` to review submissions resource manager in `src/codemagic/apple/app_store_connect/versioning/review_submissions.py` to retrieve submission items list from App Store Connect.
- `AppStoreConnectError` exceptions now have field `api_error: Optional[ErrorResponse]` to store App Store Connect API error information.

**Documentation**
- Update documentation for action groups
- `app-store-connect app-store-versions`,
- `app-store-connect review-submissions`,
- `app-store-connect review-submission-items`.
- Add documentation for actions:
- `app-store-connect app-store-versions get`,
- `app-store-connect review-submissions items`,
- `app-store-connect review-submission-items delete`.
- Update documentation for actions:
- `app-store-connect app-store-versions localizations`,
- `app-store-connect review-submission-items create`,
- `app-store-connect create-profile`.

Version 0.47.4
-------------

Expand Down
1 change: 1 addition & 0 deletions docs/app-store-connect/app-store-versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,6 @@ Enable verbose logging for commands
| :--- | :--- |
|[`create`](app-store-versions/create.md)|Add a new App Store version to an app using specified build.|
|[`delete`](app-store-versions/delete.md)|Delete specified App Store version from Apple Developer portal|
|[`get`](app-store-versions/get.md)|Read App Store Version information|
|[`localizations`](app-store-versions/localizations.md)|List All App Store Version Localizations for an App Store Version. Get a list of localized, version-level information about an app, for all locales.|
|[`modify`](app-store-versions/modify.md)|Update the app store version for a specific app.|
95 changes: 95 additions & 0 deletions docs/app-store-connect/app-store-versions/get.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@

get
===


**Read App Store Version information**
### Usage
```bash
app-store-connect app-store-versions get [-h] [--log-stream STREAM] [--no-color] [--version] [-s] [-v]
[--log-api-calls]
[--api-unauthorized-retries UNAUTHORIZED_REQUEST_RETRIES]
[--api-server-error-retries SERVER_ERROR_RETRIES]
[--disable-jwt-cache]
[--json]
[--issuer-id ISSUER_ID]
[--key-id KEY_IDENTIFIER]
[--private-key PRIVATE_KEY]
[--certificates-dir CERTIFICATES_DIRECTORY]
[--profiles-dir PROFILES_DIRECTORY]
APP_STORE_VERSION_ID
```
### Required arguments for action `get`

##### `APP_STORE_VERSION_ID`


UUID value of the App Store Version
### Optional arguments for command `app-store-connect`

##### `--log-api-calls`


Turn on logging for App Store Connect API HTTP requests
##### `--api-unauthorized-retries, -r=UNAUTHORIZED_REQUEST_RETRIES`


Specify how many times the App Store Connect API request should be retried in case the called request fails due to an authentication error (401 Unauthorized response from the server). In case of the above authentication error, the request is retried usinga new JSON Web Token as many times until the number of retries is exhausted. If not given, the value will be checked from the environment variable `APP_STORE_CONNECT_API_UNAUTHORIZED_RETRIES`. [Default: 3]
##### `--api-server-error-retries=SERVER_ERROR_RETRIES`


Specify how many times the App Store Connect API request should be retried in case the called request fails due to a server error (response with status code 5xx). In case of server error, the request is retried until the number of retries is exhausted. If not given, the value will be checked from the environment variable `APP_STORE_CONNECT_API_SERVER_ERROR_RETRIES`. [Default: 3]
##### `--disable-jwt-cache`


Turn off caching App Store Connect JSON Web Tokens to disk. By default generated tokens are cached to disk to be reused between separate processes, which can can reduce number of false positive authentication errors from App Store Connect API. If not given, the value will be checked from the environment variable `APP_STORE_CONNECT_DISABLE_JWT_CACHE`.
##### `--json`


Whether to show the resource in JSON format
##### `--issuer-id=ISSUER_ID`


App Store Connect API Key Issuer ID. Identifies the issuer who created the authentication token. Learn more at https://developer.apple.com/documentation/appstoreconnectapi/creating_api_keys_for_app_store_connect_api. If not given, the value will be checked from the environment variable `APP_STORE_CONNECT_ISSUER_ID`. Alternatively to entering `ISSUER_ID` in plaintext, it may also be specified using the `@env:` prefix followed by an environment variable name, or the `@file:` prefix followed by a path to the file containing the value. Example: `@env:<variable>` uses the value in the environment variable named `<variable>`, and `@file:<file_path>` uses the value from the file at `<file_path>`.
##### `--key-id=KEY_IDENTIFIER`


App Store Connect API Key ID. Learn more at https://developer.apple.com/documentation/appstoreconnectapi/creating_api_keys_for_app_store_connect_api. If not given, the value will be checked from the environment variable `APP_STORE_CONNECT_KEY_IDENTIFIER`. Alternatively to entering `KEY_IDENTIFIER` in plaintext, it may also be specified using the `@env:` prefix followed by an environment variable name, or the `@file:` prefix followed by a path to the file containing the value. Example: `@env:<variable>` uses the value in the environment variable named `<variable>`, and `@file:<file_path>` uses the value from the file at `<file_path>`.
##### `--private-key=PRIVATE_KEY`


App Store Connect API private key used for JWT authentication to communicate with Apple services. Learn more at https://developer.apple.com/documentation/appstoreconnectapi/creating_api_keys_for_app_store_connect_api. If not provided, the key will be searched from the following directories in sequence for a private key file with the name `AuthKey_<key_identifier>.p8`: private_keys, ~/private_keys, ~/.private_keys, ~/.appstoreconnect/private_keys, where <key_identifier> is the value of `--key-id`. If not given, the value will be checked from the environment variable `APP_STORE_CONNECT_PRIVATE_KEY`. Alternatively to entering `PRIVATE_KEY` in plaintext, it may also be specified using the `@env:` prefix followed by an environment variable name, or the `@file:` prefix followed by a path to the file containing the value. Example: `@env:<variable>` uses the value in the environment variable named `<variable>`, and `@file:<file_path>` uses the value from the file at `<file_path>`.
##### `--certificates-dir=CERTIFICATES_DIRECTORY`


Directory where the code signing certificates will be saved. Default:&nbsp;`$HOME/Library/MobileDevice/Certificates`
##### `--profiles-dir=PROFILES_DIRECTORY`


Directory where the provisioning profiles will be saved. Default:&nbsp;`$HOME/Library/MobileDevice/Provisioning Profiles`
### Common options

##### `-h, --help`


show this help message and exit
##### `--log-stream=stderr | stdout`


Log output stream. Default `stderr`
##### `--no-color`


Do not use ANSI colors to format terminal output
##### `--version`


Show tool version and exit
##### `-s, --silent`


Disable log output for commands
##### `-v, --verbose`


Enable verbose logging for commands
7 changes: 7 additions & 0 deletions docs/app-store-connect/app-store-versions/localizations.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ app-store-connect app-store-versions localizations [-h] [--log-stream STREAM] [-
[--private-key PRIVATE_KEY]
[--certificates-dir CERTIFICATES_DIRECTORY]
[--profiles-dir PROFILES_DIRECTORY]
[--locale LOCALES]
APP_STORE_VERSION_ID
```
### Required arguments for action `localizations`
Expand All @@ -25,6 +26,12 @@ app-store-connect app-store-versions localizations [-h] [--log-stream STREAM] [-


UUID value of the App Store Version
### Optional arguments for action `localizations`

##### `--locale, -l=da | de-DE | el | en-AU | en-CA | en-GB | en-US | es-ES | es-MX | fi | fr-CA | fr-FR | id | it | ja | ko | ms | nl-NL | no | pt-BR | pt-PT | ru | sv | th | tr | vi | zh-Hans | zh-Hant`


The locale code name for App Store metadata in different languages. See available locale code names from https://developer.apple.com/documentation/appstoreconnectapi/betabuildlocalizationcreaterequest/data/attributes. Multiple arguments
### Optional arguments for command `app-store-connect`

##### `--log-api-calls`
Expand Down
2 changes: 1 addition & 1 deletion docs/app-store-connect/create-profile.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Alphanumeric ID value of the Signing Certificate. Multiple arguments
##### `--device-ids=DEVICE_RESOURCE_IDS`


Alphanumeric ID value of the Device. Multiple arguments
Alphanumeric ID value of the Device. Required for development profile types. Multiple arguments
##### `--type=IOS_APP_ADHOC | IOS_APP_DEVELOPMENT | IOS_APP_INHOUSE | IOS_APP_STORE | MAC_APP_DEVELOPMENT | MAC_APP_DIRECT | MAC_APP_STORE | MAC_CATALYST_APP_DEVELOPMENT | MAC_CATALYST_APP_DIRECT | MAC_CATALYST_APP_STORE | TVOS_APP_ADHOC | TVOS_APP_DEVELOPMENT | TVOS_APP_INHOUSE | TVOS_APP_STORE`


Expand Down
1 change: 1 addition & 0 deletions docs/app-store-connect/review-submission-items.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,4 @@ Enable verbose logging for commands
|Action|Description|
| :--- | :--- |
|[`create`](review-submission-items/create.md)|Add contents to review submission for App Store review request|
|[`delete`](review-submission-items/delete.md)|Delete specified Review Submission item|
6 changes: 3 additions & 3 deletions docs/app-store-connect/review-submission-items/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ app-store-connect review-submission-items create [-h] [--log-stream STREAM] [--n
[--private-key PRIVATE_KEY]
[--certificates-dir CERTIFICATES_DIRECTORY]
[--profiles-dir PROFILES_DIRECTORY]
APP_STORE_VERSION_ID
REVIEW_SUBMISSION_ID
--app-custom-product-page-version-id APP_CUSTOM_PRODUCT_PAGE_VERSION_ID
--app-event-id APP_EVENT_ID
--version-id APP_STORE_VERSION_ID
--app-store-version-experiment-id APP_STORE_VERSION_EXPERIMENT_ID
```
### Required arguments for action `create`

##### `APP_STORE_VERSION_ID`
##### `REVIEW_SUBMISSION_ID`


UUID value of the App Store Version
UUID value of the review submission
##### `--app-custom-product-page-version-id=APP_CUSTOM_PRODUCT_PAGE_VERSION_ID`


Expand Down
102 changes: 102 additions & 0 deletions docs/app-store-connect/review-submission-items/delete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@

delete
======


**Delete specified Review Submission item**
### Usage
```bash
app-store-connect review-submission-items delete [-h] [--log-stream STREAM] [--no-color] [--version] [-s] [-v]
[--log-api-calls]
[--api-unauthorized-retries UNAUTHORIZED_REQUEST_RETRIES]
[--api-server-error-retries SERVER_ERROR_RETRIES]
[--disable-jwt-cache]
[--json]
[--issuer-id ISSUER_ID]
[--key-id KEY_IDENTIFIER]
[--private-key PRIVATE_KEY]
[--certificates-dir CERTIFICATES_DIRECTORY]
[--profiles-dir PROFILES_DIRECTORY]
[--ignore-not-found]
REVIEW_SUBMISSION_ITEM_ID
```
### Required arguments for action `delete`

##### `REVIEW_SUBMISSION_ITEM_ID`


UUID value of the review submission
### Optional arguments for action `delete`

##### `--ignore-not-found`


Do not raise exceptions if the specified resource does not exist.
### Optional arguments for command `app-store-connect`

##### `--log-api-calls`


Turn on logging for App Store Connect API HTTP requests
##### `--api-unauthorized-retries, -r=UNAUTHORIZED_REQUEST_RETRIES`


Specify how many times the App Store Connect API request should be retried in case the called request fails due to an authentication error (401 Unauthorized response from the server). In case of the above authentication error, the request is retried usinga new JSON Web Token as many times until the number of retries is exhausted. If not given, the value will be checked from the environment variable `APP_STORE_CONNECT_API_UNAUTHORIZED_RETRIES`. [Default: 3]
##### `--api-server-error-retries=SERVER_ERROR_RETRIES`


Specify how many times the App Store Connect API request should be retried in case the called request fails due to a server error (response with status code 5xx). In case of server error, the request is retried until the number of retries is exhausted. If not given, the value will be checked from the environment variable `APP_STORE_CONNECT_API_SERVER_ERROR_RETRIES`. [Default: 3]
##### `--disable-jwt-cache`


Turn off caching App Store Connect JSON Web Tokens to disk. By default generated tokens are cached to disk to be reused between separate processes, which can can reduce number of false positive authentication errors from App Store Connect API. If not given, the value will be checked from the environment variable `APP_STORE_CONNECT_DISABLE_JWT_CACHE`.
##### `--json`


Whether to show the resource in JSON format
##### `--issuer-id=ISSUER_ID`


App Store Connect API Key Issuer ID. Identifies the issuer who created the authentication token. Learn more at https://developer.apple.com/documentation/appstoreconnectapi/creating_api_keys_for_app_store_connect_api. If not given, the value will be checked from the environment variable `APP_STORE_CONNECT_ISSUER_ID`. Alternatively to entering `ISSUER_ID` in plaintext, it may also be specified using the `@env:` prefix followed by an environment variable name, or the `@file:` prefix followed by a path to the file containing the value. Example: `@env:<variable>` uses the value in the environment variable named `<variable>`, and `@file:<file_path>` uses the value from the file at `<file_path>`.
##### `--key-id=KEY_IDENTIFIER`


App Store Connect API Key ID. Learn more at https://developer.apple.com/documentation/appstoreconnectapi/creating_api_keys_for_app_store_connect_api. If not given, the value will be checked from the environment variable `APP_STORE_CONNECT_KEY_IDENTIFIER`. Alternatively to entering `KEY_IDENTIFIER` in plaintext, it may also be specified using the `@env:` prefix followed by an environment variable name, or the `@file:` prefix followed by a path to the file containing the value. Example: `@env:<variable>` uses the value in the environment variable named `<variable>`, and `@file:<file_path>` uses the value from the file at `<file_path>`.
##### `--private-key=PRIVATE_KEY`


App Store Connect API private key used for JWT authentication to communicate with Apple services. Learn more at https://developer.apple.com/documentation/appstoreconnectapi/creating_api_keys_for_app_store_connect_api. If not provided, the key will be searched from the following directories in sequence for a private key file with the name `AuthKey_<key_identifier>.p8`: private_keys, ~/private_keys, ~/.private_keys, ~/.appstoreconnect/private_keys, where <key_identifier> is the value of `--key-id`. If not given, the value will be checked from the environment variable `APP_STORE_CONNECT_PRIVATE_KEY`. Alternatively to entering `PRIVATE_KEY` in plaintext, it may also be specified using the `@env:` prefix followed by an environment variable name, or the `@file:` prefix followed by a path to the file containing the value. Example: `@env:<variable>` uses the value in the environment variable named `<variable>`, and `@file:<file_path>` uses the value from the file at `<file_path>`.
##### `--certificates-dir=CERTIFICATES_DIRECTORY`


Directory where the code signing certificates will be saved. Default:&nbsp;`$HOME/Library/MobileDevice/Certificates`
##### `--profiles-dir=PROFILES_DIRECTORY`


Directory where the provisioning profiles will be saved. Default:&nbsp;`$HOME/Library/MobileDevice/Provisioning Profiles`
### Common options

##### `-h, --help`


show this help message and exit
##### `--log-stream=stderr | stdout`


Log output stream. Default `stderr`
##### `--no-color`


Do not use ANSI colors to format terminal output
##### `--version`


Show tool version and exit
##### `-s, --silent`


Disable log output for commands
##### `-v, --verbose`


Enable verbose logging for commands
1 change: 1 addition & 0 deletions docs/app-store-connect/review-submissions.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,4 @@ Enable verbose logging for commands
|[`confirm`](review-submissions/confirm.md)|Confirm pending review submission for App Review|
|[`create`](review-submissions/create.md)|Create a review submission request for application's latest App Store Version|
|[`get`](review-submissions/get.md)|Read Review Submission information|
|[`items`](review-submissions/items.md)|List review submission items for specified review submission|
Loading

0 comments on commit a3688de

Please sign in to comment.