# tbi-copolo-mobile-app - UAT Environment

## Pipeline Overview

CircleCI pipeline for `tbi-copolo-mobile-app` — a React Native mobile app deploying to TestFlight (iOS) and Firebase App Distribution (Android). Modeled on the `tbi-rlv-redtag-app` pipeline.

## Triggered Branches
- `uat` (UAT builds)

## Pipeline Stages
1. **lint-and-test** - Install deps, lint, test
2. **build-ios** - Build iOS archive via xcodebuild, export IPA, upload to TestFlight
3. **build-android** - Build Android APK via Gradle, upload to Firebase App Distribution

## App Identifiers (Copolo)
| Item | Value |
|------|-------|
| iOS workspace | `CopoloMobileApp.xcworkspace` |
| iOS scheme | `CopoloMobileApp` |
| iOS build config | `Release` |
| iOS bundle id | `com.travel.copolo.app` |
| Apple Team ID | `K38857JV5P` |
| Android applicationId | `com.copolomobileapp` |
| Android keystore file | `copolo-release.jks` |
| Android key alias | `copolo-android` |
| Firebase App ID (Android) | `1:212579392629:android:d629ac820678b6762aac3c` |

## Required CircleCI Context Variables (`devops-mgt`)

> All Copolo variables are prefixed with `COPOLO_` because this CircleCI context is shared with `tbi-rlv-redtag-app`. This avoids collisions with RedTag's variables (e.g. `ANDROID_KEYSTORE_BASE64`).

### iOS (TestFlight)
- `COPOLO_IOS_DISTRIBUTION_CERTIFICATE_BASE64` - Base64-encoded .p12 distribution certificate
- `COPOLO_IOS_CERTIFICATE_PASSWORD` - Password for the .p12 certificate
- `COPOLO_IOS_PROVISIONING_PROFILE_BASE64` - Base64-encoded provisioning profile
- `COPOLO_KEYCHAIN_PASSWORD` - Temporary keychain password (any value)
- `COPOLO_APP_STORE_CONNECT_API_KEY_ID` - App Store Connect API key ID
- `COPOLO_APP_STORE_CONNECT_API_KEY_BASE64` - Base64-encoded App Store Connect API key (.p8)
- `COPOLO_APP_STORE_CONNECT_ISSUER_ID` - App Store Connect issuer ID
- `COPOLO_APPLE_APP_ID` - **__NEEDS_INPUT__** numeric App Store app ID (used as `--apple-id`)

### Android (Firebase)
- `COPOLO_ANDROID_KEYSTORE_BASE64` - Base64-encoded `copolo-release.jks` release keystore
- `COPOLO_MYAPP_UPLOAD_STORE_PASSWORD` - Keystore store password
- `COPOLO_MYAPP_UPLOAD_KEY_PASSWORD` - Key password
- `COPOLO_FIREBASE_APP_ID` - Firebase App ID for distribution (`1:212579392629:android:d629ac820678b6762aac3c`)
- `COPOLO_FIREBASE_SERVICE_ACCOUNT_JSON` - Firebase service account JSON (`copolodev-firebase-adminsdk-fbsvc-eb6f8a`)

### App environment (.env — sourced from context)
`AWS_COGNITO_*`, `AWS_S3_BUCKET_USER_FILES*`, `AWS_STATIC_CONTENT_URL`, `AWS_PINPOINT_APP_ID`,
`COPOLO_*_API_ENDPOINT` / `*_REGION`, `ADYEN_*`, `COPOLO_APPLE_MERCHANT_ID`, `GOOGLE_MAPS_API_KEY`,
`GOOGLE_PLACES_API_KEY`, `GOOGLE_PLACES_API`, `MIXPANNEL_TOKEN`, `TRUSTYOU_API_KEY`,
`APP_ENV`, `APP_NAME`, `ENABLE_ANALYTICS`, `ENABLE_PUSH_NOTIFICATIONS`,
`ANDROID_APP_UPDATE_URL`, `IOS_APP_UPDATE_URL`

## Updating Secrets
Secrets are managed via CircleCI context `devops-mgt`. To update:
1. Go to CircleCI → Organization Settings → Contexts → `devops-mgt`
2. Update the relevant environment variable
3. Re-run the pipeline

> **Security note:** never hardcode keystore passwords, API keys, or endpoints in `config.yml`.
> All such values must live in the CircleCI context.
