|
| 1 | +# GitHub Actions CI/CD Configuration |
| 2 | + |
| 3 | +This document describes how to set up and configure the GitHub Actions CI/CD pipeline for the Sendbird UIKit React Native project. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The GitHub Actions workflow handles automated deployment of both iOS and Android sample applications using modern authentication methods and optimized caching strategies. |
| 8 | + |
| 9 | +## Required GitHub Secrets |
| 10 | + |
| 11 | +### Shared |
| 12 | + |
| 13 | +- **SENDBIRD_APP_ID** |
| 14 | + - Your Sendbird application ID |
| 15 | + - Used to configure the sample app environment |
| 16 | + |
| 17 | +### Android Deployment |
| 18 | + |
| 19 | +- **FASTLANE_ANDROID_SERVICE_ACCOUNT** |
| 20 | + - Create service account with Firebase App Distribution role from Google Cloud Console |
| 21 | + - Download JSON key file |
| 22 | + - Encode as base64: `cat service-account.json | base64` |
| 23 | + - Save encoded text to GitHub Secrets |
| 24 | + - Decoding reference: `echo "encoded-base64-text" | base64 --decode` |
| 25 | + |
| 26 | +- **FASTLANE_ANDROID_APP_ID** |
| 27 | + - Open your Firebase project settings → General |
| 28 | + - Find your Android app (formatted like `1:xxxxxxxxxxxxxxxx:android:xxxxx`) |
| 29 | + - Save app ID to GitHub Secrets |
| 30 | + |
| 31 | +### iOS Deployment |
| 32 | + |
| 33 | +#### App Store Connect API Authentication (Recommended) |
| 34 | + |
| 35 | +- **APP_STORE_CONNECT_API_KEY_ID** |
| 36 | + - API Key ID from App Store Connect |
| 37 | + - Format: 10-character alphanumeric string (e.g., `D83848D23B`) |
| 38 | + |
| 39 | +- **APP_STORE_CONNECT_API_ISSUER_ID** |
| 40 | + - API Key Issuer ID from App Store Connect |
| 41 | + - Format: UUID (e.g., `227b0bbf-ada8-458c-9d62-3d8022b7d07f`) |
| 42 | + |
| 43 | +- **APP_STORE_CONNECT_API_KEY** |
| 44 | + - Private key content from the downloaded `.p8` file |
| 45 | + - Include the full key with headers: |
| 46 | + ``` |
| 47 | + -----BEGIN PRIVATE KEY----- |
| 48 | + [Key content] |
| 49 | + -----END PRIVATE KEY----- |
| 50 | + ``` |
| 51 | +
|
| 52 | +#### Certificate Management |
| 53 | +
|
| 54 | +- **FASTLANE_IOS_MATCH_GIT_URL** |
| 55 | + - SSH URL to the private repository storing certificates |
| 56 | + - Format: `[email protected]:organization/certificates-repo.git` |
| 57 | + - Must use SSH format for authentication |
| 58 | +
|
| 59 | +- **FASTLANE_IOS_MATCH_GIT_PRIVATE_KEY** |
| 60 | + - SSH private key for accessing the match repository |
| 61 | + - Generate with: `ssh-keygen -t rsa -b 4096 -C "[email protected]"` |
| 62 | + - Add the public key to the certificates repository as a deploy key |
| 63 | + - Save the private key content to GitHub Secrets |
| 64 | +
|
| 65 | +- **FASTLANE_IOS_MATCH_PASSWORD** |
| 66 | + - Password used to encrypt/decrypt certificates in the match repository |
| 67 | + - Can be found in the match repository |
| 68 | +
|
| 69 | +## How to Generate App Store Connect API Key |
| 70 | +
|
| 71 | +1. **Login to App Store Connect** |
| 72 | + - Go to [App Store Connect](https://appstoreconnect.apple.com) |
| 73 | + - Sign in with your Apple ID |
| 74 | +
|
| 75 | +2. **Navigate to API Keys** |
| 76 | + - Users and Access → Integrations → App Store Connect API |
| 77 | +
|
| 78 | +3. **Create New API Key** |
| 79 | + - Click "Generate API Key" |
| 80 | + - Set name: `GitHub Actions - Sendbird UIKit` |
| 81 | + - Select access: `Developer` role |
| 82 | + - Download the `.p8` file immediately (cannot re-download) |
| 83 | +
|
| 84 | +4. **Configure GitHub Secrets** |
| 85 | + - **Key ID**: Copy from the API key details page |
| 86 | + - **Issuer ID**: Copy from the API key details page |
| 87 | + - **Key Content**: Copy entire content of the `.p8` file |
| 88 | +
|
| 89 | +## Workflow Features |
| 90 | +
|
| 91 | +### Caching Strategy |
| 92 | +- **Node.js Dependencies**: Cached based on `yarn.lock` hash |
| 93 | +- **CocoaPods**: Cached based on `Podfile.lock` hash with validation |
| 94 | +- **Ruby Gems**: Cached automatically by `ruby/setup-ruby` action |
| 95 | +
|
| 96 | +### Security |
| 97 | +- **SSH Authentication**: For accessing private certificate repositories |
| 98 | +- **API Key Authentication**: Modern App Store Connect authentication |
| 99 | +- **Secret Validation**: Pre-flight checks for required environment variables |
| 100 | +
|
| 101 | +### Platform Support |
| 102 | +- **iOS**: Automatic TestFlight deployment |
| 103 | +- **Android**: Firebase App Distribution deployment |
| 104 | +- **Conditional Execution**: Platform-specific deployment based on input selection |
| 105 | +
|
| 106 | +## Troubleshooting |
| 107 | +
|
| 108 | +### Common Issues |
| 109 | +
|
| 110 | +1. **Pod Cache Validation Failures** |
| 111 | + - Clear GitHub Actions cache for the repository |
| 112 | + - Actions → Caches → Delete affected cache entries |
| 113 | +
|
| 114 | +2. **SSH Authentication Failures** |
| 115 | + - Verify the private key format (include headers and footers) |
| 116 | + - Check if the public key is added to the certificates repository |
| 117 | +
|
| 118 | +3. **App Store Connect API Errors** |
| 119 | + - Verify all three API key components are correctly set |
| 120 | + - Ensure the API key has sufficient permissions |
| 121 | + - Check the `.p8` file content format |
| 122 | +
|
| 123 | +## Maintenance |
| 124 | +
|
| 125 | +- **API Keys**: Renew App Store Connect API keys before expiration (typically 1 year) |
| 126 | +- **Certificates**: Monitor certificate expiration dates in the match repository |
| 127 | +- **SSH Keys**: Rotate SSH keys periodically for security |
| 128 | +- **Dependencies**: Keep fastlane and related tools updated |
0 commit comments