# Bitbucket

<div align="left"><img src="https://727226624-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MjFmyReUsbJqDjHEAlW%2Fuploads%2Fc1OujpeUwWPgIjTUqbpn%2Fbitbucket.png?alt=media&#x26;token=b39c62e9-cc5f-4383-8140-f689d76af279" alt=""></div>

## Set up

### Navigate to the Integration settings view

1. Select an app in the top left corner from the Switcher
2. Navigate to **App Settings** by clicking the gear icon (⚙️) at the top of the Timeline sidebar
3. Click on **Integrations** in the sidebar

### **Connect Bitbucket**

* Find the **Bitbucket** integration module under the **Version control** section
* Click the **Connect** button
* You’ll be taken through a standard Bitbucket OAuth flow
  * Select a specific Bitbucket org if you’re a member of multiple (otherwise will be pre-selected)

{% hint style="warning" %}
You must be logged in as a Bitbucket user with read/write permissions in the selected Bitbucket org.
{% endhint %}

* Bitbucket redirects you back to Runway, Runway presents a dialog in which to select the Bitbucket repository you want to connect

### **Add a release tag pattern**

* Runway uses this to read tags from Bitbucket and delineate your releases, and also to generate tags when auto-tagging releases upon completion
* Pattern accepts the string `{version}` as a stand-in for the release version, e.g. `v{version}`

{% hint style="info" %}
Runway expects version strings that adhere to [Semantic Versioning](https://semver.org/) principles — formatted as `x.y.z` (representing `major.minor.patch`).
{% endhint %}

### **Add a release branch pattern**

* For GitFlow or similar, pattern accepts the string `{version}` as a stand-in for the release version, e.g. `release-ios-{version}` &#x20;
  * You can assign different patterns to different types of releases using the **Release type** dropdown
* Omit pattern for trunk-based, e.g. `main` &#x20;
  * Be sure to select **all types** in the **Release type** dropdown

### Add any additional branches

* Working branch: your main working branch, e.g. `development`
* Staging branch: if you create your Release Candidate builds from some branch other than your release branch, set that here
* Deploy branch: if you create your final builds from some branch other than your release branch, set that here

### Adjusting permissions in Bitbucket

Certain permissions need to be configured in Bitbucket in order for Runway to execute [automations](https://docs.runway.team/automations/types-of-automations).

#### **How to update branch protection settings in Bitbucket**

To enable Runway to bypass pull request restrictions on Bitbucket and push directly to a target branch, follow these steps:

1. Go to a repository in a project
2. Choose **Settings** > **Branch permissions** and select the target branch
3. Under the **Prevent changes without a pull request except by:** restriction, select the user that originally installed the Bitbucket integration in Runway

{% hint style="warning" %}
Bitbucket's integration with Runway is OAuth-based, which means that the integration's scopes and permission are tied to those of the Bitbucket user that ran through the OAuth flow in Runway. To avoid unintentionally granting push access to a specific user (and to avoid integration issues if that user leaves the company), we *strongly suggest* setting up a service account user to use for authentication between Bitbucket and Runway.
{% endhint %}
