Build Expo apps with turtle-cli

react-native

#1

My goal: build Expo standalone apps in bitrise without rejecting from Expo

Problem: currently I use expo-cli to build binaries (expo build:ios, expo build:android). Because these calls can not made in non-interative mode (I have to provide secrets etc), I can’t use bitrise to automate this, so i do this by hand.

Turtle CLI is a command line interface for building Expo standalone apps. Is there any way to use bitrise with turtle-cli to build expo apps?


#2

Hi!

Currently we don’t have step for the Turtle-CLI but you can still use it on Bitrise:

via Turtle CLI & Generic file Storage

“If you prefer to not rely on our builders stability and you don’t like waiting in the queue to get your standalone app build then you can build your Expo project on your own. The only thing you need is Turtle CLI. Turtle CLI is a command line interface for building Expo standalone apps. You can use it both on your CI and your private computer.”

iOS

  1. Prepare the following unless you’re building only for the iOS simulator:

    • Apple Team ID - (a 10-character string like “Q2DBWS92CA”)
    • Distribution Certificate .p12 file (+ password)
    • Push Notification Certificate .p12 file (+ password)
    • Provisioning Profile

      You need to upload a Distribution Certificate, a Push Notification Certificate, and an App Store Distribution Provisioning Profile to the generic file storage on Bitrise.\
  2. Set the EXPO_IOS_DIST_P12_PASSWORD and the EXPO_IOS_PUSH_P12_PASSWORD environment variables with the values of the Distribution Certificate password and Push Notification Certificate password, respectively.\

  3. $ turtle build:ios \
      --team-id YOUR_TEAM_ID \
      --dist-p12-path /path/to/your/dist/cert.p12 \
      --push-p12-path /path/to/your/push/cert.p12 \
      --provisioning-profile-path /path/to/your/provisioning/profile.mobileprovision
      
    
  4. If the build finishes successfully, you will find the path to the build artifact in the last line of the logs.\

    Turtle CLI documentation: Building Standalone Apps on Your CI - Expo Documentation

Bitrise sample:

turtle_ipa:
    steps:
    - activate-ssh-key@4.0.3:
        run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
    - generic-file-storage@0.9.0: {}
    - git-clone: {}
    - npm@1.0.1:
        inputs:
        - command: install -g turtle-cli
        title: Install Turtle CLI
    - script@1.1.5:
        inputs:
        - content: |-
            #!/usr/bin/env bash
            set -e
            set -x

            turtle build:ios --team-id $APPLE_TEAM_ID --dist-p12-path $GENERIC_FILE_STORAGE/dist.p12 --push-p12-path $GENERIC_FILE_STORAGE/push.p12 --provisioning-profile-path $GENERIC_FILE_STORAGE/sample_Project_Expo_dist.mobileprovision
        title: Turtle Build iOS
    - deploy-to-bitrise-io: {}

via Turtle CLI and Expo fetch

iOS

If you already generated an IPA via the Expo CLI on your local machine, then you can fetch the code signing files for the Turtle CLI from the Expo server:

You can obtain these values from Expo servers by running expo fetch:ios:certs in your Expo project’s directory.

  • EXPO_APPLE_TEAM_ID - Apple Team ID - (a 10-character string like “Q2DBWS92CA”)
  • EXPO_IOS_DIST_P12_BASE64 - base64-encoded iOS Distribution Certificate
  • EXPO_IOS_DIST_P12_PASSWORD - iOS Distribution Certificate password
  • EXPO_IOS_PUSH_P12_BASE64 - base64-encoded iOS Push Notifications Certificate
  • EXPO_IOS_PUSH_P12_PASSWORD - iOS Push Notifications Certificate password
  • EXPO_IOS_PROVISIONING_PROFILE_BASE64 - base64-encoded iOS Provisioning Profile

Bitrise sample:

turtle_ipa_with_expo_fetch:
    steps:
    - activate-ssh-key@4.0.3:
        run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
    - git-clone: {}
    - npm@1.0.1:
        inputs:
        - command: install -g expo-cli
        title: Install Expo CLI
    - npm@1.0.1:
        inputs:
        - command: install
        title: Install node modules
    - script@1.1.5:
        title: Expo CLI login - Script
        inputs:
        - content: |-
            #!/usr/bin/env bash
            set -e
            set -x

            expo login --non-interactive -u $EXPO_USERNAME -p $EXPO_PASSWORD
    - script@1.1.5:
        title: Expo CLI iOS certs fetch
        inputs:
        - content: |-
            #!/usr/bin/env bash
            set -e
            set -x

            expo fetch:ios:certs
    - npm@1.0.1:
        inputs:
        - command: install -g turtle-cli
        title: Install Turtle CLI
    - script@1.1.5:
        inputs:
        - content: |-
            #!/usr/bin/env bash
            set -e
            set -x

            turtle build:ios --team-id $TEAM_ID --dist-p12-path ./sample-project-expo_dist.p12 --push-p12-path ./sample-project-expo_push.p12 --provisioning-profile-path ./sample-project-expo.mobileprovision
        title: Turtle Build iOS
    - deploy-to-bitrise-io: {}