|
| 1 | +# 📌 Bitbucket Pipelines Guide |
| 2 | + |
| 3 | +## 📖 Overview |
| 4 | +This project uses **Bitbucket Pipelines** for automating builds, deployments |
| 5 | +Bitbucket Pipelines is configured with firebase to: |
| 6 | + |
| 7 | +- **Auto-trigger builds** when pushing code to `develop`, `staging`, or `production`. |
| 8 | +- **Support manual execution** using **custom pipelines** for specific tasks. |
| 9 | + |
| 10 | +--- |
| 11 | + |
| 12 | +## 🚀 Automatic Branch-Based Pipelines |
| 13 | +When code is pushed to a branch (`develop`, `staging`, `production`), Bitbucket Pipelines will execute different tasks depending on what has changed. |
| 14 | + |
| 15 | +### 🔹 Conditional Builds |
| 16 | +```yaml |
| 17 | +condition: |
| 18 | + changesets: |
| 19 | + includePaths: |
| 20 | + - "ios/**" |
| 21 | + - "android/**" |
| 22 | + - "package.json" |
| 23 | + - "*.env.*" |
| 24 | + ... |
| 25 | +``` |
| 26 | + • If these files change, a full build (Xcode & Android) is triggered. |
| 27 | + |
| 28 | +### 🔹 Pipeline Execution Flow |
| 29 | + |
| 30 | +| Branch | Condition | Action | |
| 31 | +|------------|-------------------------------------------------|---------------------------------------| |
| 32 | +| `develop` | Code changes in `ios/`, `android/`, `package.json`, `.env.*` | Full Build & Upload to TestFlight(iOS) | |
| 33 | +| `staging` | Always builds | Full Build & Upload | |
| 34 | +| `production` | Always builds | Full Build & Upload | |
| 35 | + |
| 36 | + |
| 37 | +## 🛠️ Running Pipelines in Bitbucket |
| 38 | + |
| 39 | +### 🔹 How to Trigger a Pipeline Manually |
| 40 | +1. Open **Bitbucket** → Navigate to your repository. |
| 41 | +2. Click **Pipelines** (left menu). |
| 42 | +3. Click **Run Pipeline**. |
| 43 | +4. Select a **Branch** (e.g., `develop`). |
| 44 | +5. Choose a **Custom Pipeline** from the dropdown: |
| 45 | + - **`buildDev`** → Manually build development version |
| 46 | + - **`buildStaging`** → Manually build staging version |
| 47 | + - **`buildProduction`** → Manually build production version |
| 48 | +6. Click **Run**. |
| 49 | + |
| 50 | +# 🔄 Environment Variables in Bitbucket Pipelines |
| 51 | + |
| 52 | +Bitbucket Pipelines relies on **environment variables** to securely manage sensitive data like API keys, App IDs, and credentials. This guide explains how to update and manage these variables effectively. |
| 53 | + |
| 54 | +--- |
| 55 | +## 📌 Environment Variables Used in Bitbucket Pipelines |
| 56 | + |
| 57 | +| Variable Name | Description | Example Value | |
| 58 | +|-------------------------|--------------------------------------------------|---------------------------| |
| 59 | +| `BITBUCKET_BUILD_NUMBER` | Auto-generated build number for tracking. | `123` | |
| 60 | +| `PROJECT_NAME` | The name of your React Native project. | `MyApp` | |
| 61 | +| `APP_ID` | The application identifier (package name). | `com.example.myapp` | |
| 62 | +| `KEYCHAIN_PASSWORD` | **macOS Keychain password** for signing iOS apps. | `"my-secure-password"` | |
| 63 | + |
| 64 | +--- |
| 65 | + |
| 66 | +## 🚀 Updating Variables in Fastlane for Bitbucket |
| 67 | + |
| 68 | +If you update any **environment variables**, make sure **Fastlane** picks up the changes by modifying your `.env` files. |
| 69 | + |
| 70 | +### 🔹 Updating `.env` File |
| 71 | +1. Navigate to the project root. |
| 72 | +2. Open or create `.env.development`, `.env.staging`, `.env.production`. |
| 73 | +3. Update the variables as needed: |
| 74 | + ```sh |
| 75 | + APP_ID=com.example.myapp |
| 76 | + PROJECT_NAME=MyApp |
0 commit comments