- Home
- Workflows and Pipelines
- Workflows
- Workflow recipes for iOS apps
Workflow recipes for iOS apps
Workflow recipes specifically for iOS apps. Some of these can be used for the iOS versions of cross-platform apps, too while some are specifically meant for native iOS apps.
Workflow Recipes provide ready-made solutions for common Workflow tasks.
Here you can find Workflow recipes specifically for iOS apps. Some of these can be used for the iOS versions of cross-platform apps, too while some are specifically meant for native iOS apps.
(iOS) Deploy to Visual Studio App Center
Description
Build and distribute your app to testers via AppCenter.
Prerequisites
-
An existing Visual Studio App Center project where your app is registered.
-
Adding the API token as a Secret your Bitrise project with the name
APPCENTER_API_TOKEN
. -
You have code signing set up. See iOS code signing for more details.
Instructions
-
Add the Xcode Archive & Export for iOS Step. Set the input variables:
-
Project path: by default
$BITRISE_PROJECT_PATH
. -
Scheme: by default
$BITRISE_SCHEME
. -
Distribution method: development, ad-hoc or enterprise.
-
-
Add the AppCenter iOS Deploy Step and set the following inputs:
-
API Token:
$APPCENTER_API_TOKEN
. -
Owner name: for example,
my-company
. -
App name: for example,
my-app
.Use the App Center CLI to get the app name since it might not be the same as the one you can see on the Visual Studio App Center website.
Check out other options in the Step documentation or in the Workflow Editor.
-
bitrise.yml
- xcode-archive@4: inputs: - project_path: "$BITRISE_PROJECT_PATH" - scheme: "$BITRISE_SCHEME" - automatic_code_signing: apple-id - distribution_method: development - appcenter-deploy-ios@2: inputs: - owner_name: my-company - app_name: my-app - api_token: "$APPCENTER_API_TOKEN"
(iOS) Cache CocoaPods dependencies
Description
Cache the content of the Pods
folder of your iOS project.
Instructions
-
Add the Bitrise.io Cache:Pull Step.
-
Add the Run CocoaPods install Step.
-
Add the Bitrise.io Cache:Push Step.
Optionally you can set Compress Archive to true. This is useful if your cached folders are bigger.
bitrise.yml
- cache-pull@2: {} - cocoapods-install@2: {} - cache-push@2: {}
(iOS) Deploy to App Store Connect / TestFlight
Description
Archive the app and upload to App Store Connect to either release it to App Store or to TestFlight.
Prerequisites
-
The source code is cloned and the dependencies (for example, Cocoapods, Carthage) are installed.
-
You have code signing set up. See iOS code signing for more details.
-
You have Apple Developer connection set up. See Apple services connection for more details.
Instructions
-
(Optional) Add the Set Xcode Project Build Number Step. Set the input variables:
-
Info.plist file path: for example,
MyApp/Info.plist
. -
Build Number: for example,
42
. -
Version Number: for example,
1.1
.
-
-
Add the Xcode Archive & Export for iOS Step. Set the input variables:
-
Project path: by default,
$BITRISE_PROJECT_PATH
. -
Scheme: by default
$BITRISE_SCHEME
. -
Distribution method: it must be set to app-store.
-
-
Add the Deploy to App Store Connect - Application Loader (formerly iTunes Connect) Step. Set the input variable Bitrise Apple Developer Connection: for example, api_key.
Even more options with Deploy to App Store Connect with Deliver (formerly iTunes Connect)
Alternatively you can use the Deploy to App Store Connect with Deliver (formerly iTunes Connect) Step as well, which gives you more options.
bitrise.yml
- set-xcode-build-number@1: inputs: - build_short_version_string: '1.0' - plist_path: BitriseTest/Info.plist - xcode-archive@4: inputs: - project_path: "$BITRISE_PROJECT_PATH" - scheme: "$BITRISE_SCHEME" - automatic_code_signing: api_key - distribution_method: app-store - deploy-to-itunesconnect-application-loader@1: inputs: - connection: api_key
(iOS) Example CI Workflow
Description
Example Workflow for commits on the main branch of an iOS app. The Workflow contains:
bitrise.yml
--- format_version: '11' default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git project_type: ios workflows: ci: steps: - activate-ssh-key@4: run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' - git-clone@6: {} - cache-pull@2: {} - cocoapods-install@2: {} - carthage@3: inputs: - carthage_options: "--use-xcframeworks --platform iOS" - recreate-user-schemes@1: inputs: - project_path: "$BITRISE_PROJECT_PATH" - xcode-test@4: inputs: - log_formatter: xcodebuild - xcodebuild_options: "-enableCodeCoverage YES" - xcode-archive@4: inputs: - project_path: "$BITRISE_PROJECT_PATH" - scheme: "$BITRISE_SCHEME" - automatic_code_signing: apple-id - distribution_method: development - deploy-to-bitrise-io@2: {} - slack@3: inputs: - channel: "#build-notifications" - webhook_url: "$SLACK_WEBHOOK" - cache-push@2: {} app: envs: - opts: is_expand: false BITRISE_PROJECT_PATH: BitriseTest.xcworkspace - opts: is_expand: false BITRISE_SCHEME: BitriseTest - opts: is_expand: false BITRISE_DISTRIBUTION_METHOD: development trigger_map: - push_branch: main workflow: ci
(iOS) Deploy to bitrise.io
Description
Build and distribute your app to testers via Bitrise.io Ship.
Prerequisites
You have code signing set up. See iOS code signing for more details.
Instructions
-
Add the Xcode Archive & Export for iOS Step. Set the input variables:
-
Project path: by default,
$BITRISE_PROJECT_PATH
. -
Scheme: by default,
$BITRISE_SCHEME
. -
Distribution method: development, ad-hoc or enterprise.
-
-
Add the Deploy to Bitrise.io - Apps, Logs, Artifacts Step.
bitrise.yml
- xcode-archive@4: inputs: - project_path: "$BITRISE_PROJECT_PATH" - scheme: "$BITRISE_SCHEME" - automatic_code_signing: apple-id - distribution_method: development - deploy-to-bitrise-io@2: {}
(iOS) Example pull request Workflow
Description
Example Workflow for iOS pull request validation. The Workflow contains:
-
Triggering the Workflow for pull requests.
bitrise.yml
--- format_version: '11' default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git project_type: ios workflows: pull-request: steps: - activate-ssh-key@4: run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' - git-clone@6: {} - cache-pull@2: {} - cocoapods-install@2: {} - carthage@3: inputs: - carthage_options: "--use-xcframeworks --platform iOS" - recreate-user-schemes@1: inputs: - project_path: "$BITRISE_PROJECT_PATH" - xcode-test@4: inputs: - log_formatter: xcodebuild - xcodebuild_options: "-enableCodeCoverage YES" - xcode-archive@4: inputs: - project_path: "$BITRISE_PROJECT_PATH" - scheme: "$BITRISE_SCHEME" - automatic_code_signing: apple-id - distribution_method: development - deploy-to-bitrise-io@2: {} - create-install-page-qr-code@1: {} - comment-on-github-pull-request@0: inputs: - body: |- ![QR code]($BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL) $BITRISE_PUBLIC_INSTALL_PAGE_URL - personal_access_token: "$GITHUB_ACCESS_TOKEN" - cache-push@2: {} app: envs: - opts: is_expand: false BITRISE_PROJECT_PATH: BitriseTest.xcworkspace - opts: is_expand: false BITRISE_SCHEME: BitriseTest - opts: is_expand: false BITRISE_DISTRIBUTION_METHOD: development trigger_map: - pull_request_source_branch: "*" workflow: pull-request
(iOS) Deploy to Firebase App Distribution
Description
Build and distribute your app to testers via Firebase App Distribution.
Prerequisites
-
An existing Firebase project where your exact bundle ID is registered. Follow the Firebase documentation for details.
-
Obtain a token from Firebase by running firebase
login:ci
locally. See the Firebase CLI docs for more details. -
Add this token as a Secret to your Bitrise project with the name
FIREBASE_TOKEN
. -
Get your Firebase App ID from your project's General Settings page and pass this value as an input variable to the [BETA] Firebase App Distribution Step.
-
You have code signing set up. See iOS code signing for more details.
Instructions
-
Add the Xcode Archive & Export for iOS Step and set the required input variables, such as Scheme, Distribution method and the desired code signing method.
-
Add the [BETA] Firebase App Distribution Step and set the following input variables:
-
Firebase token: use the secret env var previously defined:
$FIREBASE_TOKEN
. -
Firebase App ID: see the Prerequisites section above for details.
-
Optionally, you can define test groups or individual testers in the Step input variables.
-
bitrise.yml
- xcode-archive@6: inputs: - distribution_method: development - scheme: # your scheme goes here - automatic_code_signing: api-key - firebase-app-distribution@0: inputs: - firebase_token: $FIREBASE_TOKEN - app: # your app ID from Firebase - testers: [email protected] # optional - groups: qa-team #optional
(iOS) Example nightly Workflow
Description
Example Workflow for nightly builds for iOS apps. The Workflow contains:
-
Setting the version and build number. By default, the app will get the build number (
$BITRISE_BUILD_NUMBER
) as the version code.
Check out our guide to run scheduled builds.
bitrise.yml
--- format_version: '11' default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git project_type: ios workflows: nightly: steps: - activate-ssh-key@4: run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' - git-clone@6: {} - cache-pull@2: {} - cocoapods-install@2: {} - carthage@3: inputs: - carthage_options: "--use-xcframeworks --platform iOS" - set-xcode-build-number@1: inputs: - build_short_version_string: '1.0' - plist_path: BitriseTest/Info.plist - recreate-user-schemes@1: inputs: - project_path: "$BITRISE_PROJECT_PATH" - xcode-archive@4: inputs: - project_path: "$BITRISE_PROJECT_PATH" - scheme: "$BITRISE_SCHEME" - automatic_code_signing: apple-id - distribution_method: app-store - deploy-to-itunesconnect-application-loader@1: inputs: - connection: apple_id - xcode-archive@4: inputs: - project_path: "$BITRISE_PROJECT_PATH" - scheme: "$BITRISE_SCHEME" - automatic_code_signing: apple-id - distribution_method: development - deploy-to-bitrise-io@2: {} - deploy-to-bitrise-io@2: {} - create-install-page-qr-code@1: {} - slack@3: inputs: - channel: "#build-notifications" - thumb_url: "$BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL" - webhook_url: "$SLACK_WEBHOOK" - cache-push@2: {} app: envs: - opts: is_expand: false BITRISE_PROJECT_PATH: BitriseTest.xcworkspace - opts: is_expand: false BITRISE_SCHEME: BitriseTest - opts: is_expand: false BITRISE_DISTRIBUTION_METHOD: development
(iOS) Run tests on a physical device
Description
Run unit or UI tests on a physical device. Our device testing solution is based on Firebase Test Lab. You can find the resulting logs, videos and screenshots on Bitrise.
Prerequisites
-
The source code is cloned and the dependencies (for example, Cocoapods, Carthage) are installed.
-
You have code signing set up. See iOS code signing for more details.
Instructions
-
Add an Xcode Build for testing for iOS Step.
-
Add a [BETA] iOS Device Testing Step and setup code signing.
-
Add a Deploy to Bitrise.io - Apps, Logs, Artifacts Step that makes the test results available in the Test Reports add-on.Test Reports
bitrise.yml
- xcode-build-for-test@1: inputs: - automatic_code_signing: api_key - virtual-device-testing-for-ios@1: {} - deploy-to-bitrise-io@2: {}
(iOS) Run tests on a simulator
Description
Run unit or UI tests of an iOS app on a simulator.
Instructions
-
Add an Xcode Test for iOS Step. Set the input variables:
-
Project path: The default value is
$BITRISE_PROJECT_PATH
and in most cases you don't have to change it. -
Scheme: The default value is
$BITRISE_SCHEME
, this variable stores the scheme that you set when adding the app on Bitrise. You can specify a different scheme if you want but it must be a shared scheme. -
Device destination specifier: (default:
platform=iOS Simulator,name=iPhone 8 Plus,OS=latest
).
Installing additional simulators for Xcode UI tests
If you need a simulator for your Xcode UI tests that is unavailable on the stack you are using, check out this article on Knowledge Base for a guide.
-
-
Add a Deploy to Bitrise.io - Apps, Logs, Artifacts Step that makes the test results available in the Test Reports add-on.
bitrise.yml
- xcode-test@4: {} - deploy-to-bitrise-io@2: {}
(iOS) Install CocoaPods dependencies
Description
Install CocoaPods dependencies. Make sure that you are using the workspace and not the project file in your Steps. To do so, check the value of $BITRISE_PROJECT_PATH
Env Var.
Instructions
-
Add the Run CocoaPods install Step.
-
(Optional) If your Podfile is not in the root, set the Podfile path input variable.
bitrise.yml
- cocoapods-install@2: {}
(iOS) Install Carthage dependencies
Description
Install Carthage dependencies.
Instructions
Add the Carthage Step. Set the input variables:
-
Github Personal Access Token: We recommend adding a GitHub access token to your Secrets (
$GITHUB_ACCESS_TOKEN
). We need this token to avoid GitHub rate limit issue. See the GitHub guide: Creating an access token for command-line use on how to create Personal Access Token. Uncheck every scope box when creating this token. There is no reason this token needs access to private information. -
(Optional) Set Additional options for carthage command: see the Carthage docs for the available options, for example,
--use-xcframeworks --platform iOS
.
Setting a specific Carthage version in your builds
If your project needs a Carthage version currently unavailable on our stacks, check out Setting a specific Carthage version in your builds.
bitrise.yml
- carthage@3: inputs: - carthage_options: "--use-xcframeworks --platform iOS"
(iOS) Example release Workflow
Description
Example Workflow for uploading a release draft of an iOS app to the App Store. The Workflow contains:
-
Setting the version number based on Env Vars passed to build (
$VERSION_NUMBER
).
bitrise.yml
--- format_version: '11' default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git project_type: ios workflows: release: steps: - activate-ssh-key@4: run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' - git-clone@6: {} - cocoapods-install@2: {} - carthage@3: inputs: - carthage_options: "--use-xcframeworks --platform iOS" - set-xcode-build-number@1: inputs: - build_short_version_string: "$VERSION_NUMBER" - build_version: "$BITRISE_BUILD_NUMBER" - plist_path: BitriseTest/Info.plist - recreate-user-schemes@1: inputs: - project_path: "$BITRISE_PROJECT_PATH" - xcode-archive@4: inputs: - project_path: "$BITRISE_PROJECT_PATH" - scheme: "$BITRISE_SCHEME" - automatic_code_signing: apple-id - distribution_method: app-store - deploy-to-itunesconnect-application-loader@1: inputs: - connection: apple_id app: envs: - opts: is_expand: false BITRISE_PROJECT_PATH: BitriseTest.xcworkspace - opts: is_expand: false BITRISE_SCHEME: BitriseTest - opts: is_expand: false BITRISE_DISTRIBUTION_METHOD: development
(iOS) Override the Apple service connection credentials using Step inputs
Description
You can override the Apple service connection credentials configured in the App Settings by setting the inputs under the App Store Connect connection override input group in the Xcode Archive & Export for iOS Step.
This can be useful if your team uses multiple App Store accounts or if you manage multiple apps in a single Bitrise app and would like to use different Apple service connections based on your Workflow.
Prerequisites
Before starting, generate or get the following using App Store Connect:
-
App Store Connect API private key.
-
App Store Connect API key ID.
-
App Store Connect API issuer ID.
For more information, check out Creating App Store Connect API private keys.
Instructions
-
Upload your App Store Connect API private key file (.p8 file) to the Generic File Storage in the Code Signing tab.
-
Add the Xcode Archive & Export for iOS Step (version 4.6.0 or newer) to your Workflow.
-
Set the Automatic code signing method input to
api-key
. -
Set the following Step inputs under the App Store Connect connection override input group:
-
App Store Connect API private key: Local path or remote URL to the private key (.p8 file) for App Store Connect API. Set this input to the automatically generated Env Var connected to the App Store Connect API private key file (.p8 file) you uploaded to the Generic File Storage in step 1.
-
App Store Connect API key ID: Private key ID used for App Store Connect authentication.
-
App Store Connect API issuer ID: Private key issuer ID used for App Store Connect authentication.
-
bitrise.yml
- xcode-archive@4: inputs: - automatic_code_signing: api-key - api_key_path: "$BITRISEIO_APP_STORE_CONNECT_API_ID_URL" - api_key_id: "$APP_STORE_API_ID" - api_key_issuer_id: "$APP_STORE_API_ISSUER_ID"
A Step is a block of script execution that encapsulates a build task on Bitrise: the code to perform that task, the inputs and parameters you can define for the task, and the outputs the task generates.
A Workflow is a collection of Steps, Environment Variables, and other configurations. When Bitrise starts a build, it runs one or more Workflows according to the configuration defined in the bitrise.yml
file.