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

Implementing sz deploy macos for Automating macOS App Deployment #745

Merged
merged 14 commits into from
Aug 18, 2023

Conversation

nilsreichardt
Copy link
Member

@nilsreichardt nilsreichardt commented Aug 17, 2023

Description

This pull request introduces a significant enhancement to our deployment pipeline, specifically for the macOS app. It automates various stages of the deployment process, including the retrieval of the next build number, app building, and publication to the App Store or TestFlight.

Key changes include:

  1. Deployment Stages and Flavors: The code defines different stages (stable, alpha) and flavors (prod) for the macOS app deployment. This allows for flexibility in managing various versions of the app.

  2. Command Line Options: Several command-line options have been added to provide necessary parameters for the deployment process. These include API keys, issuer ID, private key, release notes, and the build flavor.

  3. Build Number Automation: The function _getNextBuildNumber is implemented to fetch the latest build number from App Store Connect and increment it for the next build.

  4. App Building and Publishing: Functions for building the app (_buildApp) and publishing it (_publish) have been implemented. They use the Codemagic CLI tools and require the build number as an argument.

  5. Environment Variables: Sensitive information, such as API keys, are fetched from environment variables, keeping them secure and out of the codebase.

  6. Refactoring of common methods: Common methods that are used to interact with App Store Connect are now globally available and can be reused in the iOS command.

This new implementation greatly simplifies the macOS deployment process, making it more streamlined and less prone to manual errors.

Testing

  • Tested the command manually by deploying a new version to the alpha group.

Usage

sz deploy macos --help

Deploys the Sharezone macOS app to the App Store or TestFlight. Automatically bumps the build number and builds the app. Codemagic CLI tools are required.

Usage: pub global run sz_repo_cli deploy macos [arguments]
-h, --help           Print this usage information.
-s, --stage          The deployment stage to deploy to. The "stable" stage is used for App Store releases, the "alpha" stage is used for TestFlight releases. The value will be forwarded to the "sz build" command.
                     [stable (default), alpha]
    --key-id         The App Store Connect API Key ID used to authenticate. This can be found in the App Store Connect Developer Portal. Learn more at https://developer.apple.com/documentation/appstoreconnectapi/creating_api_keys_for_app_store_connect_api. If the parameter is not provided, the value of the APP_STORE_CONNECT_KEY_IDENTIFIER environment variable will be used. If no value is set, the deployment will fail. Example value: 1234567890
    --issuer-id      The App Store Connect API Key Issuer ID used to authenticate. This can be found in the App Store Connect Developer Portal. Learn more at https://developer.apple.com/documentation/appstoreconnectapi/creating_api_keys_for_app_store_connect_api. If the parameter is not provided, the value of the APP_STORE_CONNECT_ISSUER_ID environment variable will be used. If no value is set, the deployment will fail. Example value: 00000000-0000-0000-0000-000000000000
    --private-key    The App Store Connect API private key used for JWT authentication to communicate with Apple services. This can be found in the App Store Connect Developer Portal. Learn more at https://developer.apple.com/documentation/appstoreconnectapi/creating_api_keys_for_app_store_connect_api. If not provided, the value will be checked from the environment variable APP_STORE_CONNECT_PRIVATE_KEY. If not given, 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 no value is set, the deployment will fail.
    --whats-new      Release notes either for TestFlight or App Store review submission. Describe what's new in this version of your app, such as new features, improvements, and bug fixes. The string should not exceed 4000 characters. Example usage: --whats-new 'Bug fixes and performance improvements.'

Run "pub global run sz_repo_cli help" to see global options.

Copy link
Collaborator

@Jonas-Sander Jonas-Sander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, although I think some code could be shared between the iOS and macOS deploy command.

@github-actions github-actions bot removed the ci/cd label Aug 17, 2023
Copy link
Collaborator

@Jonas-Sander Jonas-Sander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, although I think some changes should be made. I'm gonna elaborate tomorrow on Discord :)

@nilsreichardt
Copy link
Member Author

Nice, although I think some changes should be made. I'm gonna elaborate tomorrow on Discord :)

Implemented :)

Copy link
Collaborator

@Jonas-Sander Jonas-Sander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, LGTM! :)

@nilsreichardt nilsreichardt added this pull request to the merge queue Aug 18, 2023
Merged via the queue into main with commit fa160cf Aug 18, 2023
@nilsreichardt nilsreichardt deleted the add-macos-deploy-command branch August 18, 2023 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants