Microsoft App Center

How to upload an apk or ipa file to App Center in a Flutter workflow editor post-build script

As a custom build step, Codemagic can publish your app artifact to App Center using the App Center Command Line Interface. An App Center API token is required for publishing. It is advisable to create a new token for use on Codemagic, see the commands related to API tokens here or manage your tokens in App Center settings. A token is generated under user settings, not app settings.

Configure environment variables

  1. Open your Codemagic app settings, and go to the Environment variables tab.

  2. Enter the desired Variable name, e.g. APP_CENTER_TOKEN.

  3. Enter your App Center API token as Variable value.

  4. Enter the variable group name, e.g. app_center_credentials. Click the button to create the group.

  5. Make sure the Secure option is selected.

  6. Click the Add button to add the variable.

  7. Repeat the steps to also add ORGANIZATION_NAME and APP_CENTER_APP_NAME variables. Username is your App Center username when signing up. Alternatively, you can use a combination of organization name (in case of creating one in the App Center UI) and Application identifier (your app’s Bundle identifier / Package name).

  8. Add the variable group to your codemagic.yaml file

      environment:
        groups:
          - app_center_credentials

Publish to App Center

Add the following script to your codemagic.yaml file. If you are using Flutter workflow editor, go to your app settings, expand the step between Build and Publish steps and add the respective post-build script.

  scripts:
    - name: Publish to App Center
      script: | 
        #!/usr/bin/env zsh

        echo 'Installing App Center CLI tools'
        npm install -g appcenter-cli

        echo "Publishing $ipaPath to App Center"
        appcenter distribute release \
            --group Collaborators \
            --file $ARTIFACT_PATH \
            --release-notes 'App submission via Codemagic' \
            --app $ORGANIZATION_NAME/$APP_CENTER_APP_NAME \
            --token $APP_CENTER_TOKEN \
            --quiet