{"id":17028436,"url":"https://github.com/nilsreichardt/codemagic-app-preview","last_synced_at":"2025-06-30T06:05:49.628Z","repository":{"id":38286368,"uuid":"499896598","full_name":"nilsreichardt/codemagic-app-preview","owner":"nilsreichardt","description":"Simplify your pull request reviews by automatically generating QR codes linked to your app builds for Android, iOS and macOS.","archived":false,"fork":false,"pushed_at":"2024-12-21T14:49:33.000Z","size":384,"stargazers_count":28,"open_issues_count":10,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T12:11:33.137Z","etag":null,"topics":["app-preview","ci","cicd","cli","code-review","codemagic"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nilsreichardt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-06-04T17:43:30.000Z","updated_at":"2024-12-21T14:49:36.000Z","dependencies_parsed_at":"2024-01-07T17:05:09.757Z","dependency_job_id":"8fc0746f-ce1b-4386-b209-1afedd4ab6e7","html_url":"https://github.com/nilsreichardt/codemagic-app-preview","commit_stats":{"total_commits":41,"total_committers":3,"mean_commits":"13.666666666666666","dds":0.3902439024390244,"last_synced_commit":"d280a751fc8d65528905bb1e407b15a676a7e120"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/nilsreichardt/codemagic-app-preview","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilsreichardt%2Fcodemagic-app-preview","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilsreichardt%2Fcodemagic-app-preview/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilsreichardt%2Fcodemagic-app-preview/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilsreichardt%2Fcodemagic-app-preview/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nilsreichardt","download_url":"https://codeload.github.com/nilsreichardt/codemagic-app-preview/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilsreichardt%2Fcodemagic-app-preview/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262720642,"owners_count":23353448,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["app-preview","ci","cicd","cli","code-review","codemagic"],"created_at":"2024-10-14T07:54:21.496Z","updated_at":"2025-06-30T06:05:49.603Z","avatar_url":"https://github.com/nilsreichardt.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"Simplify your pull request reviews by automatically generating QR codes linked to your app builds for Android, iOS and macOS with Codemagic App Preview CLI. This CLI allows code reviewers to easily download and test the app in a real-world environment, making the review process more effective and efficient.\n\nIn other words: It's like the Firebase Hosting GitHub Action [`action-hosting-deploy`](https://github.com/FirebaseExtended/action-hosting-deploy) to create web app preview URLs for pull requests but for Android, iOS and macOS apps.\n\nThis CLI is built on top of [Codemagic](https://codemagic.io). Codemagic is a CI/CD provider for mobile dev teams. It supports building, testing, and publishing Flutter, iOS, Android, React Native, Ionic and Unity apps. Codemagic offers 500 free minutes macOS M2 per month for individuals. For more information, see the [Codemagic pricing page](https://codemagic.io/pricing/).\n\n| \u003cimg width=\"920\" alt=\"Demo of the app preview pull request comment\" src=\"https://github.com/nilsreichardt/codemagic-app-preview/assets/24459435/91612c03-2d13-4b2c-ba80-6a2070d36862\"\u003e | \u003cimg alt=\"Demo of scanning the iOS app preview qr code\" src=\"https://user-images.githubusercontent.com/24459435/179368786-c94ce9c2-2129-4c30-8677-b8ebf5633a2e.gif\" width=235 /\u003e |\n| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n\nAfter building your app, you only need to add the `app_preview post` command to the publishing scripts of your `codemagic.yaml` file.\n\n```yaml\nworkflows:\n  app_preview:\n    name: app_preview\n    environment: ...\n    triggering: ...\n    scripts: ...\n    artifacts:\n      - build/**/outputs/apk/**/*.apk\n      - build/ios/ipa/*.ipa\n      - build/macos/Build/Products/Release/*.app\n    publishing:\n      scripts:\n        - name: Post App Preview\n          script: |\n            dart pub global activate codemagic_app_preview\n            app_preview post \\\n             --github_token $GITHUB_PAT \\\n             --codemagic_token $CODEMAGIC_TOKEN\n```\n\n## Supported platforms\n\nCurrently, you can generate a preview only for the following platforms.\n\n| Android | iOS | macOS | Web | Linux | Windows |\n| :-----: | :-: | :---: | :-: | :---: | :-----: |\n|   ✔️    | ✔️  |  ✔️   |     |       |         |\n\nIf you are interested in supporting Web, Linux, or Windows, please [upvote the respective issue](https://github.com/nilsreichardt/codemagic-app-preview/issues?q=is%3Aopen+is%3Aissue+label%3Aplatform).\n\n## Supported technologies\n\nCurrently, you can generate a preview for the following technologies.\n\n| Flutter | React Native | Ionic | Unity  | iOS | Android | macOS | Web | Linux | Windows |\n| :-----: | :----------: | :---: | :----: | :-: | :-----: | :---: | :-: | :---: | ------- |\n|   ✔️    |      ✔️      |  ✔️   |   ✔️   |  ✔️ |   ✔️    |  ✔️   |     |       |         |\n\nEven this CLI is written in Dart, you can use it with any technology and you don't need to use Flutter. The Dart SDK is already pre-installed on Codemagic machines.\n\n## Supported Git hosts\n\n|  GitHub | GitLab | Self-Hosted GitLab | Bitbucket |\n| :-----: | :----: | :----------------: | :-------: |\n|   ✔️    |   ✔️   |                    |           |\n\nIf you are interested in supporting self-hosted GitLab, Bitbucket or a different Git host, please [upvote the respective issue](https://github.com/nilsreichardt/codemagic-app-preview/issues?q=is%3Aopen+is%3Aissue+label%3Agit-hosts).\n\n## Features\n\n- 📱 **QR Code Generation:** Generates QR codes linked to app builds for Android, iOS, and macOS, enabling easy download and testing in real-world environments.\n- 🔗 **Direct Download Links:** Provides direct download links along with QR codes in pull request comments for quick access to app builds.\n- 🔄 **Comment Updates:** Updates existing comments with new builds to avoid cluttering the pull request with multiple comments.\n- 💬 **Custom Messages:** Allows the addition of custom messages in comments to convey additional information or instructions.\n- 🏢 **Monorepo Support:** Offers support for monorepos with multiple apps, allowing the posting of multiple comments in the same pull request.\n- ⚙️ **Minimal Configuration:** Easy setup with minimal configuration needed, streamlining the integration process.\n- 🚫 **Third-party Service Independence:** Eliminates the need for TestFlight, Firebase App Distribution, or other third-party services to distribute your app, keeping the process in-house.\n- 🌍 **Real-world Testing:** Facilitates testing of the app in real-world environments, making the review process more effective and efficient.\n- ⏰ **Time Efficiency:** Helps teams save valuable time of engineers during the review process, optimizing resource utilization and enhancing productivity.\n- 🏷️ **Label-based Triggering:** Allows you to restrict the build process to only occur for pull requests with specific labels. By default, the build is triggered for every pull request. This provides flexibility and conserves build minutes.\n\n## Options\n\n|  Option             | Required or Optional?        | Description                                                                                                                                                                                                                                                        |  Example                                                                                                                                                   |\n| ------------------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |\n|  `--github_token`   | **Required** if using GitHub | Your personal access token to access the GitHub API.                                                                                                                                                                                                               | `abc123`                                                                                                                                                   |\n|  `--gitlab_token`   | **Required** if using GitLab | Your personal access token to access the GitLab API.                                                                                                                                                                                                               | `xyz789`                                                                                                                                                   |\n| `--codemagic_token` | **Required**                 | Token to access the Codemagic API. Is available at: Teams \u003e Personal Account \u003e Integrations \u003e Codemagic API \u003e Show. See [Codemagic documentation](https://docs.codemagic.io/rest-api/codemagic-rest-api/).                                                         | `pqr456`                                                                                                                                                   |\n|  `--message`        | Optional                     | Custom message to include in the comment.                                                                                                                                                                                                                          | \"Only team members are able to install the iOS app.\", see [this example](https://github.com/SharezoneApp/sharezone-app/pull/1095#issuecomment-1733715519). |\n|  `--expires_in`     | Optional                     | Defines the duration for which the URLs to the artifacts are valid. The maximum duration depends on your account type, see [Codemagic documentation](https://docs.codemagic.io/billing/pricing/#build-history-and-artifact-storage). The default value is 30 days. | `2w 6d 23h 59m 59s` or `365d`                                                                                                                              |\n| `--app_name`        | Optional                     | The name of the app. This is helpful if you have multiple apps in the same repository. Using different names for different apps allows you to post multiple comments in the same pull request.                                                                     | `sharezone`                                                                                                                                                |\n| `--qr-code-size`    | Optional                     |  The size of the QR code in pixels as an integer. The default value is 200.                                                                                                                                                                                        | `500` or `400`                                                                                                                                             |\n\n## Quick Start Guide\n\nThis is a quick guide to get you started with Codemagic App Preview. For more detailed information, see the [step-by-step guide](#step-by-step-guide).\n\nHere is an example for the `codemagic.yaml`.\n\n```yaml\nworkflows:\n  app_preview:\n    name: app_preview\n    environment:\n      ios_signing:\n        distribution_type: ad_hoc\n        bundle_identifier: YOUR_BUNDLE_IDENTIFIER\n      groups:\n        # Adding environment group \"github\" which includes the GITHUB_PAT\n        # variable. GITHUB_PAT is required for posting / editing comments on the pull request\n        - \"github\"\n        # Adding environment group \"codemagic\" which includes the CODEMAGIC_TOKEN\n        # variable. Required to make the builds accessible for the app preview tool.\n        - \"codemagic\"\n    triggering:\n      events:\n        - pull_request\n    scripts:\n      # If you are not using Flutter, you need to add the build scripts for your\n      # platform.\n      - name: Build APK (Android)\n        script: flutter build apk\n      - name: Build macOS\n        script: flutter build macos\n      - name: Build IPA (iOS)\n        script: |\n          flutter build ipa \\\n            --export-options-plist=/Users/builder/export_options.plist\n    # Adding artifacts for Android, iOS, and macOS builds.\n    artifacts:\n      - build/**/outputs/apk/**/*.apk\n      - build/ios/ipa/*.ipa\n      - build/macos/Build/Products/Release/*.app\n    publishing:\n      scripts:\n        - name: Post App Preview\n          script: |\n            dart pub global activate codemagic_app_preview\n            app_preview post \\\n              --github_token $GITHUB_PAT \\\n              --codemagic_token $CODEMAGIC_TOKEN\n```\n\n## Step-by-step guide\n\nThis is the detailed and step-by-step guide to get you started with the Codemagic App Preview CLI. Currently, the docs are only using the `codemagic.yaml` file.\n\nIf you use the Workflow Editor and you are interested in a step-by-step guide for the Workflow Editor, please [upvote this issue](https://github.com/nilsreichardt/codemagic-app-preview/issues/93). However, the steps for the Workflow Editor are very similar to the steps for the `codemagic.yaml` file. After building the app, you just need to add the `app_preview post` command to the \"Pre-publish script\" in the Workflow Editor.\n\n### 0. Preparation\n\nYou need to have a Codemagic account. If you don't have a Codemagic account yet, you can create one for free at [codemagic.io](https://codemagic.io). For individuals, there is also a [free plan](https://codemagic.io/pricing/). Make sure that your Git repository is [connected to Codemagic](https://docs.codemagic.io/getting-started/adding-apps/).\n\n### 1. Add your Codemagic API token to your Codemagic environment variables\n\nFirst, you need to get your Codemagic API token to access the Codemagic API. You can find it at: Teams \u003e Personal Account \u003e Integrations \u003e Codemagic API \u003e Show. See [Codemagic documentation](https://docs.codemagic.io/rest-api/codemagic-rest-api/).\n\nWhen you have your Codemagic API token, you need to add it to your Codemagic environment variables of the repository you want to use the Codemagic App Preview tool with.\n\n1. Go to your repository on Codemagic.\n2. Navigate to \"Environment Variables\"\n3. Enter `CODEMAGIC_TOKEN` as the variable name\n4. Paste the token into the variable value field\n5. Select or create new group, such as \"codemagic\"\n6. Ensure \"Secure\" is checked\n\n### 2. Add your GitHub/GitLab personal access token to your Codemagic environment variables\n\n#### Why is a GitHub/GitLab personal access token required?\n\nThe Codemagic App Preview tool uses the GitHub/GitLab API to post comments on pull requests. To do so, it needs a personal access token to authenticate with the GitHub/GitLab API. The token is not stored anywhere; it is only used to post comments on pull requests.\n\n#### GitHub\n\nThis documentation uses the new fine-grained tokens to follow security best practices. If you are using the old tokens (classic tokens), you need to enable the `repo` scope.\n\n1. Go to [Developer Settings \u003e Personal access tokens \u003e Fine-grained tokens](https://github.com/settings/tokens?type=beta)\n2. Click on \"Generate new token\"\n3. Give the token a name, such as \"Codemagic App Preview\"\n4. Select the repository where you want to use the Codemagic App Preview tool\n5. Open the repository permissions\n6. Add read and write permission for pull requests (and read only permission for metadata)\n7. Click \"Generate token\"\n8. If you are using the token of a repository in an organization, make sure that fine-grained personal access tokens are allowed\\\n   a) Go to the organization settings -\u003e Personal access tokens -\u003e Settings. At \"Fine-grained personal access tokens\" the option \"Allow access via fine-grained personal access tokens\" needs be selected\\\n   b) If personal access token require approval by your organization administrator, make sure that your token is approved.\n\n\u003ca href=\"https://github.com/nilsreichardt/codemagic-app-preview/assets/24459435/a6a4a707-6012-403c-b7c4-55a5b90fa0f9\" target=\"_blank\"\u003e\u003cimg src=\"https://github.com/nilsreichardt/codemagic-app-preview/assets/24459435/1aed0040-5039-416c-9b4a-f5d972290fda\" alt=\"Screenshot of creating GitHub personal access token\"/\u003e\u003c/a\u003e\n\n#### GitLab\n\n1. Open Settings\n2. Select \"CI/CD\"\n3. Expand the \"Variables\" section\n4. Click on \"Add variable\"\n\n\u003ca href=\"https://github.com/nilsreichardt/codemagic-app-preview/assets/24459435/c7186275-b71d-49b2-ada0-01f354bd42f0\" target=\"_blank\"\u003e\u003cimg src=\"https://github.com/nilsreichardt/codemagic-app-preview/assets/24459435/fb55183d-f450-417a-b061-e35db01c4154\" alt=\"Screenshot of creating GitLab personal access token\"/\u003e\u003c/a\u003e\n\n### 3. Set up the `codemagic.yaml`\n\nNow, we need to set up the `codemagic.yaml` file to build the app and post the app preview comment.\n\n#### 3.1. Define a basic workflow with the environment variables\n\nFirst, we need to define a basic workflow with the environment variables. The environment variables are required to access the GitHub/GitLab API and the Codemagic API. Additionally, you need to add `ios_signing` if you want to build iOS apps. Checkout the Codemagic docs, if you need more information about [iOS code signing](https://docs.codemagic.io/yaml-code-signing/signing-ios/).\n\n```yaml\nworkflows:\n  app_preview:\n    name: app_preview\n    environment:\n      # Docs for setting up signing: https://docs.codemagic.io/yaml-code-signing/signing-ios/\n      ios_signing:\n        # Use the type \"ad_hoc\" to sign iOS apps in order to install them on your device.\n        distribution_type: ad_hoc\n        bundle_identifier: YOUR_BUNDLE_IDENTIFIER\n      groups:\n        # Adding environment group \"github\" which includes the GITHUB_PAT\n        # variable.\n        - \"github\"\n        # Adding environment group \"codemagic\" which includes the CODEMAGIC_TOKEN\n        # variable.\n        - \"codemagic\"\n```\n\nNow, we need to add the `triggering` section to define when the workflow should be triggered. If you want to trigger the workflow on every pull request, you can use the following configuration.\n\n```yaml\nworkflows:\n  app_preview:\n    name: app_preview\n    environment: ...\n    triggering:\n      events:\n        - pull_request\n```\n\nIf you don't want to trigger the workflow on every pull request, you use the option to only trigger the workflow on pull requests with a specific label. For example, you can use the label `build-app-preview` to trigger the workflow only on pull requests with the label `build-app-preview`.\n\nTo do so, please check out the [\"Only trigger the workflow on pull requests with a specific label\" ](#only-trigger-the-workflow-on-pull-requests-with-a-specific-label) section in at the bottom of this README.\n\n#### 3.2. Build the app\n\nNext, we need to build the app. You can use the following scripts to build the app for Android, iOS, and macOS. You can leave out the scripts for the platforms you don't need.\n\n```yaml\nworkflows:\n  app_preview:\n    name: app_preview\n    environment: ...\n    triggering: ...\n    scripts:\n      - name: Build APK (Android)\n        script: flutter build apk\n      - name: Build macOS\n        script: flutter build macos\n      - name: Build IPA (iOS)\n        # Don't forget the \"export-options\" argument.\n        script: |\n          flutter build ipa \\\n            --export-options-plist=/Users/builder/export_options.plist\n```\n\n#### 3.3. Add the artifacts\n\nIn order to post the app preview comment, we need to make the build artifacts available. You can use the following configuration to add the build artifacts for Android, iOS, and macOS.\n\n```yaml\nworkflows:\n  app_preview:\n    name: app_preview\n    environment: ...\n    triggering: ...\n    scripts: ...\n    artifacts:\n      - build/**/outputs/apk/**/*.apk\n      - build/ios/ipa/*.ipa\n      - build/macos/Build/Products/Release/*.app\n```\n\nIf you don't need all platforms, you can leave out the artifacts for the platforms you don't need.\n\n### 4. Add the publishing script\n\nAs the last step, we need to add the publishing script to post the app preview comment.\n\n```yaml\nworkflows:\n  app_preview:\n    name: app_preview\n    environment: ...\n    triggering: ...\n    scripts: ...\n    artifacts: ...\n    publishing:\n      scripts:\n        - name: Post App Preview\n          script: |\n            dart pub global activate codemagic_app_preview\n            app_preview post \\\n              --github_token $GITHUB_PAT \\\n              --codemagic_token $CODEMAGIC_TOKEN\n```\n\nIn this script, we first install the Codemagic App Preview CLI. Then, we use the `app_preview post` command to post the app preview comment. The `app_preview post` command requires a few options to work. You can find more information about the options in the [options section](#options).\n\n```yaml\nartifacts:\n  - build/**/outputs/apk/**/*.apk # Build output for Android\n  - build/ios/ipa/*.ipa # Build output for iOS\n  - build/macos/Build/Products/Release/*.app # Build output for macOS\npublishing:\n  scripts:\n    - name: Post App Preview\n      script: |\n        # You should use for app the following line instead of \"dart pub\n        # global activate  -s path...\":\n        # dart pub global activate codemagic_app_preview\n\n        # Using local path to test changes and ensure everything is working\n        # when someone opens PR.\n        dart pub global activate -s path ../codemagic_app_preview\n        app_preview post \\\n          --github_token $GITHUB_PAT \\\n          --codemagic_token $CODEMAGIC_TOKEN \\\n          --message \"This is a custom message.\"\n```\n\n### 5. Combine all steps\n\nNow, we can combine all steps to get the final `codemagic.yaml` file.\n\n```yaml\nworkflows:\n  app_preview:\n    name: app_preview\n    environment:\n      ios_signing:\n        distribution_type: ad_hoc\n        bundle_identifier: YOUR_BUNDLE_IDENTIFIER\n      groups:\n        # Adding environment group \"github\" which includes the GITHUB_PAT\n        # variable. GITHUB_PAT is required for posting / editing comments on the pull request\n        - \"github\"\n        # Adding environment group \"codemagic\" which includes the CODEMAGIC_TOKEN\n        # variable. Required to make the builds accessible for the app preview tool.\n        - \"codemagic\"\n    triggering:\n      events:\n        - pull_request\n    scripts:\n      # If you are not using Flutter, you need to add the build scripts for your\n      # platform.\n      - name: Build APK (Android)\n        script: flutter build apk\n      - name: Build macOS\n        script: flutter build macos\n      - name: Build IPA (iOS)\n        script: |\n          flutter build ipa \\\n            --export-options-plist=/Users/builder/export_options.plist\n    # Adding artifacts for Android, iOS, and macOS builds.\n    artifacts:\n      - build/**/outputs/apk/**/*.apk\n      - build/ios/ipa/*.ipa\n      - build/macos/Build/Products/Release/*.app\n    publishing:\n      scripts:\n        - name: Post App Preview\n          script: |\n            dart pub global activate codemagic_app_preview\n            app_preview post \\\n              --github_token $GITHUB_PAT \\\n              --codemagic_token $CODEMAGIC_TOKEN\n```\n\n## Only trigger the workflow on pull requests with a specific label\n\nThe easiest way to use this CLI is to trigger the workflow on every pull request. Especially if you have the [Codemagic unlimited plan](https://codemagic.io/pricing/), this is the recommended way to use this CLI. However, if you don't have the unlimited plan, you might want to only trigger the workflow on pull requests with a specific label to avoid unnecessary builds.\n\nIn order to do so, you need to trigger the workflow with the [Codemagic Build API](https://docs.codemagic.io/rest-api/builds/) via [GitHub Actions](https://github.com/features/actions). Make sure to also remove the `triggering` section from the `codemagic.yaml` file and you created the \"build-app-preview\" (you can also use a different label) label.\n\n```yaml\nname: App Preview\n\non:\n  pull_request:\n    types:\n      # Trigger the workflow when a label is added or removed.\n      - labeled\n      # Trigger the workflow when a pull request is opened or synchronized.\n      - synchronize\n\njobs:\n  label_app_preview:\n    # Only run this job if the PR is labeled with \"build-app-preview\".\n    #\n    # Keep in mind that a new build will be triggered when the PR is labeled\n    # with any lable as long as the label \"build-app-preview\" is included in the\n    # list of labels. For example, if the PR is labeled with \"build-app-preview\"\n    # and \"bug\", the job will be triggered when the label \"bug\" is removed.\n    if: contains(github.event.pull_request.labels.*.name, 'build-app-preview')\n    runs-on: ubuntu-22.04\n    env:\n      CODEMAGIC_TOKEN: ${{ secrets.CODEMAGIC_TOKEN }}\n      CODEMAGIC_APP_ID: ${{ secrets.CODEMAGIC_APP_ID }}\n      # From \"codemagic.yaml\"\n      CODEMAGIC_WORKFLOW_ID: \"app_preview\"\n    steps:\n      - name: Start Codemagic Build\n        run: |\n          # Get the pull request number from the GITHUB_REF.\n          PULL_REQUEST_NUMBER=$(echo $GITHUB_REF | cut -d / -f 3)\n\n          curl --request POST 'https://api.codemagic.io/builds' \\\n            -f \\\n            --header 'x-auth-token: '\"$CODEMAGIC_TOKEN\" \\\n            --header 'Content-Type: application/json' \\\n            --data-raw \"{\n                \\\"appId\\\": \\\"$CODEMAGIC_APP_ID\\\",\n                \\\"branch\\\": \\\"$GITHUB_HEAD_REF\\\",\n                \\\"workflowId\\\": \\\"$CODEMAGIC_WORKFLOW_ID\\\",\n                \\\"environment\\\": {\n                    \\\"variables\\\": {\n                        \\\"CM_PULL_REQUEST_NUMBER\\\": $PULL_REQUEST_NUMBER\n                    }\n                }\n            }\"\n```\n\nUnder [this link](https://github.com/SharezoneApp/sharezone-app/blob/main/.github/workflows/label_app_preview.yaml), you can find an example repository with the GitHub Action. If you need an example pull request, checkout [this pull request](https://github.com/SharezoneApp/sharezone-app/pull/1095) where the GitHub Action and the label `build-app-preview` has been used.\n\nIf you are not using GitHub, you can create a similar workflow for your Git host. Feel free, to open a pull request to add an example for your Git host.\n\nIn case you are interested in triggering Codemagic builds with labels, you can upvote the [feature request](https://github.com/orgs/codemagic-ci-cd/discussions/2080).\n\n## Monorepos\n\nIf you are using a monorepo, you might encounter situations where multiple apps are built in the same pull request. In this case, you can use the `--app_name` option to post multiple comments in the same pull request.\n\n```yaml\nworkflows:\n  app_1_app_preview:\n    name: app_1_app_preview\n    scripts: ...\n    artifacts: ...\n    publishing:\n      scripts:\n        - name: Post App Preview\n          script: |\n            dart pub global activate codemagic_app_preview\n            app_preview post \\\n              --github_token $GITHUB_PAT \\\n              --codemagic_token $CODEMAGIC_TOKEN \\\n              --app_name \"App 1\"\n\n  app_2_app_preview:\n    name: app_2_app_preview\n    scripts: ...\n    artifacts: ...\n    publishing:\n      scripts:\n        - name: Post App Preview\n          script: |\n            dart pub global activate codemagic_app_preview\n            app_preview post \\\n              --github_token $GITHUB_PAT \\\n              --codemagic_token $CODEMAGIC_TOKEN \\\n              --app_name \"App 2\"\n```\n\n## FAQ\n\n### How is it possible to install the iOS app without TestFlight?\n\nThe iOS app is signed with an ad hoc provisioning profile. This allows you to install the app on your device without TestFlight. However, you need to register your device with a valid Apple Developer account. When you are using XCode to run the app on your device, XCode will automatically register your device. Your registered devices are listed in the [Apple Developer portal](https://developer.apple.com/account/resources/devices/list) under \"Certificates, Identifiers \u0026 Profiles\" \u003e \"Devices\".\n\nIf your repository is open source, it might be helpful, to add a note with the `--message` option to inform users that only team members are able to install the iOS app.\n\n### Where are the artifacts stored?\n\nThe artifacts are stored by Codemagic. The Codemagic App Preview CLI uses the Codemagic API to get the download URLs for the artifacts. The download URLs are valid for 30 days by default. You can change the duration with the `--expires_in` option. The maximum duration depends on your account type, see [Codemagic documentation](https://docs.codemagic.io/billing/pricing/#build-history-and-artifact-storage).\n\n## Limits\n\n- To install iOS artifacts, your device must be registered with a valid Apple Developer account.\n- This package only works when has been triggered by a pull request event.\n\n## Disclaimer\n\nThis is an unofficial package for [Codemagic](https://codemagic.io). It's _not_ maintained by Codemagic.\n\nIf you have any feedback about the CLI or the documentation, feel free to open an [issue](https://github.com/nilsreichardt/codemagic-app-preview/issues) or a [pull request](https://github.com/nilsreichardt/codemagic-app-preview/pulls).\n\nYou like this tool? Feel free to give it a star ⭐️ on [GitHub](https://github.com/nilsreichardt/codemagic-app-preview).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnilsreichardt%2Fcodemagic-app-preview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnilsreichardt%2Fcodemagic-app-preview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnilsreichardt%2Fcodemagic-app-preview/lists"}