- Home
- References
- Workflow reference
Workflow reference
All bitrise.yml properties
You can find the complete list of available properties in the bitrise.yml format specification / reference docs of the CLI.
A Workflow is a collection of Steps, Environment Variables, and other configurations
for a single bitrise run
command.
The only requirement for a Workflow is an ID. As an example, in this configuration we declared one Workflow with the ID test
.
format_version: 1.3.1 workflows: test:
You can define multiple Workflows and run a specific Workflow with bitrise run WORKFLOWID
.
Defining two Workflows:
format_version: 1.3.1 workflows: first: second:
List all available Workflows in a bitrise.yml
file:
bitrise run
Or, alternatively:
bitrise workflows
To add Steps to a Workflow simply include steps:
and then add the Step(s).
format_version: 11 default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git workflows: test: steps: - script: title: First step - script: title: Second step
You can define Workflow-specific parameters and Environment Variables. A Workflow’s Environment Variables are used when the Workflow is executed, and are available for every Step in the Workflow:
format_version: 11 default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git workflows: test: envs: - ENV_VAR_ONE: first value - ENV_VAR_TWO: second value
You can chain Workflows to run multiple Workflows before and/or after a specific Workflow.
format_version: 1.3.1 default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git workflows: send-notifications: steps: # send notifications setup: steps: # setup Steps to run test: before_run: - setup envs: - IS_TEST: "true" steps: # test Steps to run ci: before_run: - test after_run: - send-notifications deploy: before_run: - test steps: # steps to deploy after_run: - send-notifications
Based on the above example, if you run:
-
bitrise run send-notifications
: only the Steps of thesend-notifications
workflow will be executed. -
bitrise run setup
: only the Steps of thesetup
Workflow will be executed. -
bitrise run test
: first the Steps of thesetup
Workflow will be executed, then the Steps declared intest
Workflow. -
bitrise run ci
: will execute the Steps of the Workflows in the following order:-
setup
-
test
-
ci
(theci
Workflow doesn’t have any Steps, but that’s not an issue. It just means that no Step will be executed here and the build will continue with the next Workflow in the chain). -
send-notifications
-
-
bitrise run deploy
: will execute the Steps of the Workflows in the following order:-
setup
-
test
-
deploy
-
send-notifications
-
This means that you can define what a setup
and test
should do in your project in the setup
and test
Workflows only once, and then you can reuse those in other Workflows. There’s no need to duplicate Steps between
Workflows.
The Bitrise CLI supports a small notation, called utility Workflow: a Workflow whose ID starts with an underscore character, for example, _setup
. A utility Workflow can't be executed directly with a bitrise run
command: they can be referenced with before_run
and after_run
properties.
You can find utility Workflows at the end of the Workflow list if you run bitrise run
or bitrise workflows
:
The following workflows are available: * ci * deploy You can run a selected workflow with: $ bitrise run WORKFLOW-ID The following utility workflows are defined: * _send-notifications * _setup * _test
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.
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.