- Home
- Workflows and Pipelines
- Workflows
- Workflow recipes for cross-platform apps
Workflow recipes for cross-platform apps
Workflow recipes for apps built with cross-platform frameworks, such as Flutter or React Native.
Workflow Recipes provide ready-made solutions for common Workflow tasks.
Here you can find Workflow recipes for apps built with cross-platform frameworks, such as Flutter or React Native.
(React Native) Cache dependencies (node_modules)
Description
Set up caching for dependencies (node_modules
folder) of a React Native app.
Instructions
-
Add the Bitrise.io Cache:Pull Step.
-
Add either the Run yarn command or the Run npm command Step to your Workflow based on your project setup. Set the input variables:
-
Set the The yarn command to run or The npm command with arguments to run input variable to
install
. -
Set Cache node_modules to
yes
.
-
-
Add the Bitrise.io Cache:Push Step.
-
(Optional) Set the Compress cache input variable to
true
. This can be useful if your cache folders are large and you are experiencing slow build times.
bitrise.yml
Using yarn
:
- cache-pull@2: {} - yarn@0: inputs: - cache_local_deps: 'yes' - command: install - cache-push@2: inputs: - compress_archive: 'true'
Using npm
:
- cache-pull@2: {} - npm@1: inputs: - cache_local_deps: 'yes' - command: install - cache-push@2: inputs: - compress_archive: 'true'
(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 Workflows 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 Add Provisioning Profile(s) and the Add a certificate (.p12 file) for code signing, respectively.
-
Make sure that the project's Android Keystore file is uploaded.
If not, drag-and-drop your keystore file to the Upload file (max. 5 MB) 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_USERNAME
andEXPO_PASSWORD
Secrets. -
On the left, select Configuration YAML from the navigation menu.
-
Copy paste
envs
frombitrise.yml
below to your Workflow. -
Copy paste
steps
frombitrise.yml
below to your Workflow.The built
.ipa
and.aab
files are exposed viaBITRISE_IPA_PATH
andBITRISE_AAB_PATH
Env 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
(React Native) Run tests
Description
Run tests, for example, in Jest.
Instructions
-
Add either the Run yarn command or the Run npm command Step to your Workflow based on your project setup.
-
Set the The yarn command to run or The npm command with arguments to run input variable to
test
.
bitrise.yml
Using yarn
:
- yarn@0: inputs: - command: test
Using npm
:
- npm@1: inputs: - command: test
(React Native) Install dependencies
Description
Install dependencies using either yarn or npm.
Instructions
-
Add either the Run yarn command or the Run npm command Step to your Workflow based on your project setup.
-
Set the The yarn command to run or The npm command with arguments to run input variable to
install
.
bitrise.yml
Using yarn
:
- yarn@0: inputs: - command: install
Using npm
:
- npm@1: inputs: - command: install
(Flutter) Run tests
Description
Runs any test in a Flutter project.
Instructions
-
Add the Flutter Test Step to your Workflow. Set the input variables:
-
Project Location: For example,
$BITRISE_FLUTTER_PROJECT_LOCATION
. -
Check out optional inputs in the Workflow Editor or in the Step description.
-
-
Add a Deploy to Bitrise.io Step that makes the test results available in the Test Reports add-on.
bitrise.yml
- flutter-test@1: inputs: - project_location: "$BITRISE_FLUTTER_PROJECT_LOCATION" - deploy-to-bitrise-io@2: {}
(Flutter) Install Flutter SDK
Description
Installs the latest stable/beta or a specific version of Flutter.
Instructions
-
Add the Flutter Install Step. Use this step before the Cache Pull step to make sure caching works correctly.
-
Install either the latest stable/beta versions or a specific version.
-
By default, the Step installs the latest stable version.
-
To install the latest beta, set the Flutter SDK git repository version input to beta.
-
To install a specific version, set the Flutter SDK installation bundle URL input. You can find the list of Flutter installation bundles here. Make sure you set the bundle based on the stack (MacOS or Linux).
Best practice
We recommend using a specific version.
-
bitrise.yml
Specific version:
--- - flutter-installer@0: inputs: - installation_bundle_url: https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_2.5.3-stable.zip
Latest stable version:
- flutter-installer@0: {}
Latest beta version:
- flutter-installer@0: inputs: - version: beta
(Flutter) Run Dart Analyzer
Description
Runs the Dart Analyzer for Flutter apps.
Instructions
Add the Flutter Analyze Step to your Workflow.
bitrise.yml
- flutter-analyze@0: inputs: - project_location: $BITRISE_FLUTTER_PROJECT_LOCATION