+ "content": "---\ndescription: How to upload an apk or ipa file to App Center in a Flutter workflow editor post-build script\ntitle: Microsoft App Center\nweight: 4\naliases: \n - /publishing/publish-app-artifacts-to-app-center\n - /flutter-publishing/publish-app-artifacts-to-app-center\n - /knowledge-base/publish-app-artifacts-to-app-center\n---\n<!-- \n @maintainer: App Center is deprecated (shutdown March 2025). \n Docs need updates to reflect alternatives (Firebase/AWS/TestFlight). \n Ref: https://appcenter.ms/ \n-->\nAs a custom build step, Codemagic can publish your app artifact to App Center using the [App Center Command Line Interface](https://github.com/microsoft/appcenter-cli). 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](https://github.com/microsoft/appcenter-cli#commands) or manage your tokens in [App Center settings](https://appcenter.ms/settings/apitokens). A token is generated under user settings, not app settings. \n\n## Configure environment variables\n\n1. Open your Codemagic app settings, and go to the **Environment variables** tab.\n2. Enter the desired **_Variable name_**, e.g. `APP_CENTER_TOKEN`.\n3. Enter your App Center API token as **_Variable value_**.\n4. Enter the variable group name, e.g. **_app_center_credentials_**. Click the button to create the group.\n5. Make sure the **Secure** option is selected.\n6. Click the **Add** button to add the variable.\n7. Repeat the steps to also add `ORGANIZATION_NAME` and `APP_CENTER_APP_NAME` variables.\n**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). \n\n8. Add the variable group to your `codemagic.yaml` file\n{{< highlight yaml \"style=paraiso-dark\">}}\n environment:\n groups:\n - app_center_credentials\n{{< /highlight >}}\n\n## Publish to App Center\n\nAdd the following script to your `codemagic.yaml` file. If you are using **Flutter workflow editor**,\ngo to your app settings, expand the step between **Build** and **Publish** steps and add the respective **post-build** script.\n\n{{< highlight yaml \"style=paraiso-dark\">}}\n scripts:\n - name: Publish to App Center\n script: | \n #!/usr/bin/env zsh\n\n echo 'Installing App Center CLI tools'\n npm install -g appcenter-cli\n\n echo \"Publishing $ipaPath to App Center\"\n appcenter distribute release \\\n --group Collaborators \\\n --file $ARTIFACT_PATH \\\n --release-notes 'App submission via Codemagic' \\\n --app $ORGANIZATION_NAME/$APP_CENTER_APP_NAME \\\n --token $APP_CENTER_TOKEN \\\n --quiet\n{{< /highlight >}}\n\n"
0 commit comments