Appetize integration

How to integrate your workflows with Appetize using codemagic.yaml

Appetize enables you to run native iOS and Android mobile apps directly in your browser. No downloads, plugins, or extra permissions needed.

A sample project that shows how to configure Appetize integration is available in our Sample projects repository.

Configure Appetize access

Before getting started you will need to generate an Appetize API token and a public key for your app.

Get Appetize token

All users with admin or developer roles may request an API token after logging in to your Appetize account page. After getting your API_TOKEN you need to add it to your environment variables in a group named appetize for example.

Get the public key for your app

To get a public key for your app, you first have to upload your app manually at least once to Appetize. After that, you can get the app publicKey and add it as an environment variable.

Configure environment variables

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

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

  3. Enter the desired variable value as Variable value.

  4. Enter the variable group name, e.g. appetize_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 add the APPETIZE_APP_PUBLIC_KEY.

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

      environment:
        groups:
          - appetize_credentials

Uploading to Appetize

After you have uploaded your app to Appetize manually once and configured the app public key, you can configure automatic publishing in your codemagic.yaml.

Add the following script to your publishing section:

  publishing:
    scripts:
      - name: Publish APK to Appetize
        script: | 
          apkPath="/build/app/outputs/flutter-apk/app-release.apk"
          echo $(curl --location --request POST 'https://'$API_TOKEN'@api.appetize.io/v1/apps/'$APP_PUBLIC_KEY'' --form 'file=@"'$apkPath'"')

Don’t forget to change the value of the apkPath to your actual apk path.

For iOS, you need to upload a .zip or .tar.gz file containing your compressed .app bundle. The whole process will consist of:

  • building the app
  • creating a .zip archive
  • publishing to Appetize
  scripts:
    - name: Build unsigned .app
      script: | 
        xcodebuild -workspace "ios/Runner.xcworkspace" \
          -scheme "$XCODE_SCHEME" \
          -configuration "Debug" \
          -sdk iphonesimulator \
          -derivedDataPath ios/output
        # If you are building a project instead of a workspace:
        # xcodebuild -project "ios/Runner.xcodeproj" \
        #   -scheme "$XCODE_SCHEME" \
        #   -configuration "Debug" \
        #   -sdk iphonesimulator \
        #   -derivedDataPath ios/output
    - name: Create a .zip archive
      script: | 
        cd ios/output/Build/Products/Debug-iphonesimulator
        zip -r ios_app.zip $XCODE_SCHEME.app
  artifacts:
    - ios/output/Build/Products/Debug-iphonesimulator/*.zip
  publishing:
    scripts:
      - name: Publish App to Appetize
        script: | 
          zipPath="ios/output/Build/Products/Debug-iphonesimulator/ios_app.zip"
          echo $(curl --location --request POST "https://$API_TOKEN@api.appetize.io/v1/apps/$APP_PUBLIC_KEY" --form "file=@$zipPath")

Don’t forget to change the value of the zipPath to your actual apk path.