(React Native) Expo: Build using Turtle CLI
Description
Publish an app to Expo's servers and build an iOS App Store .ipa and an Android .aab file from your Expo project using Turtle CLI.
Prerequisites
-
Generate an iOS Distribution Certificate and an App Store Provisioning Profile based on the Generating iOS code signing files guide.
-
Generate an Android Keystore by following the Android code signing with Android Studio guide.
-
Make sure you can Publish your Expo project locally.
Instructions
-
Log in to Bitrise and select Bitrise CI on the left, then select your project.
-
Click the button on the main page.
-
Go to the Code Signing & Files tab.
-
Make sure that the project's iOS Distribution Certificate and App Store Provisioning Profile are uploaded.
If not, add them in the and the , respectively.
-
Make sure that the project's Android Keystore file is uploaded.
If not, drag-and-drop your keystore file to the field of the ANDROID KEYSTORE FILE section.
-
Go to the Secrets tab.
-
Create a Secret (
IOS_DEVELOPMENT_TEAM) with the ID of the iOS Development Team issued in the project's Certificate and Provisioning Profile. -
Store the Expo account's username and password used for publishing in
EXPO_USERNAMEandEXPO_PASSWORDSecrets. -
On the left, select Configuration YAML from the navigation menu.
-
Copy paste
envsfrombitrise.ymlbelow to your Workflow. -
Copy paste
stepsfrombitrise.ymlbelow to your Workflow.The built
.ipaand.aabfiles are exposed viaBITRISE_IPA_PATHandBITRISE_AAB_PATHEnv Vars.
bitrise.yml
turtle_build:
envs:
- KEYSTORE_PATH: /tmp/keystore.jks
- KEYSTORE_ALIAS: $BITRISEIO_ANDROID_KEYSTORE_ALIAS
- EXPO_ANDROID_KEYSTORE_PASSWORD: $BITRISEIO_ANDROID_KEYSTORE_PASSWORD
- EXPO_ANDROID_KEY_PASSWORD: $BITRISEIO_ANDROID_KEYSTORE_PRIVATE_KEY_PASSWORD
- PROFILE_PATH: /tmp/profile.mobileprovision
- CERTIFICATE_PATH: /tmp/certificate.p12
- EXPO_IOS_DIST_P12_PASSWORD: $BITRISE_CERTIFICATE_PASSPHRASE
# Define these in your secrets
- IOS_DEVELOPMENT_TEAM: $IOS_DEVELOPMENT_TEAM
- EXPO_USERNAME: $EXPO_USERNAME
- EXPO_PASSWORD: $EXPO_PASSWORD
steps:
- script@1:
title: Install dependencies
inputs:
- content: |-
#!/usr/bin/env bash
set -ex
node --version
fastlane --version
npm install -g turtle-cli
turtle --version
npm install -g expo-cli
expo --version
- file-downloader@1:
title: Download Android Keystore
inputs:
- destination: $KEYSTORE_PATH
- source: $BITRISEIO_ANDROID_KEYSTORE_URL
- file-downloader@1:
title: Download iOS Certificate
inputs:
- destination: $CERTIFICATE_PATH
- source: $BITRISE_CERTIFICATE_URL
- file-downloader@1:
title: Download iOS Provisioning Profile
inputs:
- destination: $PROFILE_PATH
- source: $BITRISE_PROVISION_URL
- npm@1:
title: Install project dependencies
inputs:
- command: install
- set-java-version@1:
title: Set Java version to Java 8
inputs:
- set_java_version: "8"
- script@1:
title: Run Expo publish
inputs:
- content: |-
#!/usr/bin/env bash
set -ex
expo login -u $EXPO_USERNAME -p $EXPO_PASSWORD --non-interactive
expo publish
- script@1:
title: Run Turtle build
inputs:
- content: |-
#!/usr/bin/env bash
set -ex
turtle setup:android
aab_path=$BITRISE_DEPLOY_DIR/expo-project.aab
turtle build:android --type app-bundle --keystore-path $KEYSTORE_PATH --keystore-alias $KEYSTORE_ALIAS -o $aab_path
envman add --key BITRISE_AAB_PATH --value $aab_path
turtle setup:ios
ipa_path=$BITRISE_DEPLOY_DIR/expo-project.ipa
turtle build:ios --team-id $IOS_DEVELOPMENT_TEAM --dist-p12-path $CERTIFICATE_PATH --provisioning-profile-path $PROFILE_PATH -o $ipa_path
envman add --key BITRISE_IPA_PATH --value $ipa_path