|
| 1 | +# 🚀 Local Android Build Workflow Setup |
| 2 | + |
| 3 | +## Problem Solved ✅ |
| 4 | + |
| 5 | +You hit your Expo.dev build limit for the next 3 days and don't want to pay $20 for a subscription. |
| 6 | + |
| 7 | +**Solution:** Build APKs directly on your local machine using GitHub Actions self-hosted runners. |
| 8 | + |
| 9 | +--- |
| 10 | + |
| 11 | +## What You Got |
| 12 | + |
| 13 | +### 1 New Workflow File |
| 14 | +- **`.github/workflows/local-android-build.yml`** - Builds APKs using Gradle on your machine |
| 15 | + |
| 16 | +### 6 Documentation Guides |
| 17 | +1. **`GETTING_STARTED.md`** ← **START HERE** (5-minute setup) |
| 18 | +2. **`LOCAL_BUILD_SETUP.md`** - Detailed setup with all prerequisites |
| 19 | +3. **`LOCAL_BUILD_QUICKSTART.md`** - Quick reference card |
| 20 | +4. **`LOCAL_BUILD_TROUBLESHOOTING.md`** - Solutions for 15+ issues |
| 21 | +5. **`LOCAL_BUILD_ARCHITECTURE.md`** - Visual diagrams |
| 22 | +6. **`IMPLEMENTATION_SUMMARY.md`** - Features overview |
| 23 | + |
| 24 | +--- |
| 25 | + |
| 26 | +## Quick Start (5 Steps) |
| 27 | + |
| 28 | +### Read This First |
| 29 | +👉 Open **`GETTING_STARTED.md`** and follow the 5-step setup (takes ~15 minutes) |
| 30 | + |
| 31 | +### What Those Steps Do |
| 32 | +1. ✅ Verify your machine has Java 17+, Android SDK, Node 22+ |
| 33 | +2. ✅ Create a GitHub Personal Access Token |
| 34 | +3. ✅ Install GitHub Actions runner on your machine |
| 35 | +4. ✅ Verify runner is online |
| 36 | +5. ✅ Trigger your first test build |
| 37 | + |
| 38 | +### After Setup |
| 39 | +- Builds run automatically on `git push` or manually via GitHub Actions |
| 40 | +- APKs download from GitHub Releases or Artifacts |
| 41 | +- Install on device: `adb install app-release-*.apk` |
| 42 | + |
| 43 | +--- |
| 44 | + |
| 45 | +## Cost Savings |
| 46 | + |
| 47 | +| | Local Build | EAS (Expo.dev) | |
| 48 | +|:-|:----------:|:-:| |
| 49 | +| **Setup** | 15 min | 2 min | |
| 50 | +| **Monthly** | $5-20* | $20+ | |
| 51 | +| **Annual** | $60-240* | $240-1200+ | |
| 52 | +| **Savings** | ✅ | ❌ | |
| 53 | + |
| 54 | +*Electricity only - No subscription fees!* |
| 55 | + |
| 56 | +**You save $240-960/year** 🎉 |
| 57 | + |
| 58 | +--- |
| 59 | + |
| 60 | +## Files Reference |
| 61 | + |
| 62 | +| File | Purpose | When to Read | |
| 63 | +|------|---------|---| |
| 64 | +| `GETTING_STARTED.md` | **5-minute setup** | **First** - Get going immediately | |
| 65 | +| `.github/workflows/local-android-build.yml` | The actual workflow | When curious about the implementation | |
| 66 | +| `LOCAL_BUILD_SETUP.md` | Detailed setup guide | If you hit prerequisites issues | |
| 67 | +| `LOCAL_BUILD_QUICKSTART.md` | Quick reference | For commands & troubleshooting | |
| 68 | +| `LOCAL_BUILD_ARCHITECTURE.md` | System design & diagrams | To understand how it works | |
| 69 | +| `LOCAL_BUILD_TROUBLESHOOTING.md` | Issue solutions | When something breaks | |
| 70 | +| `IMPLEMENTATION_SUMMARY.md` | Feature overview | For complete reference | |
| 71 | + |
| 72 | +--- |
| 73 | + |
| 74 | +## Workflow Overview |
| 75 | + |
| 76 | +``` |
| 77 | +Push Code (or manual trigger) |
| 78 | + ↓ |
| 79 | +GitHub Actions detects trigger |
| 80 | + ↓ |
| 81 | +Runs on YOUR self-hosted runner |
| 82 | + ↓ |
| 83 | +1. npm install dependencies |
| 84 | +2. npm run prepare (create Expo bundle) |
| 85 | +3. ./gradlew assembleRelease (Gradle builds APK) |
| 86 | + ↓ |
| 87 | +APK signed with debug keystore |
| 88 | + ↓ |
| 89 | +Uploaded to GitHub Artifacts |
| 90 | + ↓ |
| 91 | +GitHub Release created with changelog |
| 92 | + ↓ |
| 93 | +Download & install: adb install app-release-*.apk |
| 94 | +``` |
| 95 | + |
| 96 | +--- |
| 97 | + |
| 98 | +## Key Features |
| 99 | + |
| 100 | +✨ **Zero Expo.dev Costs** |
| 101 | +- Build directly on your machine |
| 102 | +- No subscription required |
| 103 | +- Only pay for electricity |
| 104 | + |
| 105 | +✨ **GitHub Integration** |
| 106 | +- Releases generated automatically |
| 107 | +- Changelogs from git commits |
| 108 | +- Artifacts retained 14 days |
| 109 | +- Real-time build logs |
| 110 | + |
| 111 | +✨ **Version Control** |
| 112 | +- Auto-increments on main branch |
| 113 | +- Pre-release versions for dev branches |
| 114 | +- Build metadata tracked |
| 115 | + |
| 116 | +✨ **Full Control** |
| 117 | +- Customize Gradle build |
| 118 | +- Modify build parameters |
| 119 | +- Access all build files |
| 120 | + |
| 121 | +✨ **Complete Documentation** |
| 122 | +- 6 detailed guides |
| 123 | +- 15+ troubleshooting solutions |
| 124 | +- Architecture diagrams |
| 125 | +- Visual references |
| 126 | + |
| 127 | +--- |
| 128 | + |
| 129 | +## You Now Have TWO Workflows |
| 130 | + |
| 131 | +### Local Build (NEW - Your Machine) |
| 132 | +- ✅ Build Android APKs |
| 133 | +- ✅ Cost: Free (electricity only) |
| 134 | +- ✅ Speed: 5-30 minutes |
| 135 | +- ❌ Requires your machine online |
| 136 | +- ❌ Can't build iOS |
| 137 | + |
| 138 | +### EAS Build (EXISTING - Expo Cloud) |
| 139 | +- ✅ Build Android & iOS |
| 140 | +- ✅ Works offline |
| 141 | +- ❌ Cost: $20+/month |
| 142 | +- ❌ Slower with queue times |
| 143 | + |
| 144 | +**Use Local Build to save money, use EAS when offline or for iOS** ✅ |
| 145 | + |
| 146 | +--- |
| 147 | + |
| 148 | +## Next Steps |
| 149 | + |
| 150 | +### Immediately |
| 151 | +1. **Read:** [`GETTING_STARTED.md`](GETTING_STARTED.md) |
| 152 | +2. **Follow:** The 5-step setup |
| 153 | +3. **Test:** Manually trigger a build |
| 154 | + |
| 155 | +### If You Get Stuck |
| 156 | +1. **Check:** [`LOCAL_BUILD_TROUBLESHOOTING.md`](LOCAL_BUILD_TROUBLESHOOTING.md) |
| 157 | +2. **Read:** [`LOCAL_BUILD_SETUP.md`](LOCAL_BUILD_SETUP.md) for detailed instructions |
| 158 | +3. Check GitHub Actions logs for error details |
| 159 | + |
| 160 | +### To Understand Everything |
| 161 | +- **Architecture:** [`LOCAL_BUILD_ARCHITECTURE.md`](LOCAL_BUILD_ARCHITECTURE.md) |
| 162 | +- **Features:** [`IMPLEMENTATION_SUMMARY.md`](IMPLEMENTATION_SUMMARY.md) |
| 163 | +- **Reference:** [`LOCAL_BUILD_QUICKSTART.md`](LOCAL_BUILD_QUICKSTART.md) |
| 164 | + |
| 165 | +--- |
| 166 | + |
| 167 | +## Typical Build Times |
| 168 | + |
| 169 | +| Scenario | Time | |
| 170 | +|----------|------| |
| 171 | +| **First build** (cold cache) | 20-30 min | |
| 172 | +| **Subsequent builds** (warm cache) | 5-10 min | |
| 173 | +| **After cache clear** | 25-35 min | |
| 174 | + |
| 175 | +*Depends on your machine specs and network speed* |
| 176 | + |
| 177 | +--- |
| 178 | + |
| 179 | +## After Build Completes |
| 180 | + |
| 181 | +### Download APK |
| 182 | +- **GitHub Actions:** Actions tab → Artifacts → `android-apk-local` |
| 183 | +- **GitHub Releases:** Releases tab → Latest release → Download APK |
| 184 | + |
| 185 | +### Install on Device |
| 186 | +```bash |
| 187 | +# USB debugging must be enabled |
| 188 | +adb install app-release-v1.0.80-build-*.apk |
| 189 | +``` |
| 190 | + |
| 191 | +### On Emulator |
| 192 | +```bash |
| 193 | +adb -e install app-release-v1.0.80-build-*.apk |
| 194 | +``` |
| 195 | + |
| 196 | +--- |
| 197 | + |
| 198 | +## File Structure |
| 199 | + |
| 200 | +``` |
| 201 | +codebuilder-app/ |
| 202 | +│ |
| 203 | +├── .github/workflows/ |
| 204 | +│ ├── eas-android-build.yml (Existing) |
| 205 | +│ └── local-android-build.yml (NEW - The workflow) |
| 206 | +│ |
| 207 | +├── GETTING_STARTED.md ← START HERE |
| 208 | +├── LOCAL_BUILD_SETUP.md (Detailed setup) |
| 209 | +├── LOCAL_BUILD_QUICKSTART.md (Quick reference) |
| 210 | +├── LOCAL_BUILD_TROUBLESHOOTING.md (Issue solutions) |
| 211 | +├── LOCAL_BUILD_ARCHITECTURE.md (System design) |
| 212 | +├── IMPLEMENTATION_SUMMARY.md (Feature overview) |
| 213 | +│ |
| 214 | +└── ... rest of your project |
| 215 | +``` |
| 216 | + |
| 217 | +--- |
| 218 | + |
| 219 | +## Runner Management |
| 220 | + |
| 221 | +After setup, manage your runner with these commands: |
| 222 | + |
| 223 | +```bash |
| 224 | +# Check if runner is online |
| 225 | +sudo systemctl status actions.runner.* |
| 226 | + |
| 227 | +# Stop runner (prevents new builds) |
| 228 | +sudo ./svc.sh stop |
| 229 | + |
| 230 | +# Start runner (enables builds) |
| 231 | +sudo ./svc.sh start |
| 232 | + |
| 233 | +# Restart (troubleshooting) |
| 234 | +sudo ./svc.sh restart |
| 235 | + |
| 236 | +# View detailed logs |
| 237 | +tail -50 ~/.github-runner/_diag/Runner_*.log |
| 238 | +``` |
| 239 | + |
| 240 | +--- |
| 241 | + |
| 242 | +## Commits Made |
| 243 | + |
| 244 | +All changes have been committed: |
| 245 | + |
| 246 | +``` |
| 247 | +6d7a063 docs: Add getting started guide (5-minute setup) |
| 248 | +074ba5f docs: Add architecture diagrams and visual guides |
| 249 | +b99e70c feat: Add local Android build workflow (self-hosted runner) |
| 250 | +``` |
| 251 | + |
| 252 | +Ready to use! ✅ |
| 253 | + |
| 254 | +--- |
| 255 | + |
| 256 | +## Support |
| 257 | + |
| 258 | +| Need Help With | See | |
| 259 | +|---|---| |
| 260 | +| Getting started | `GETTING_STARTED.md` | |
| 261 | +| Prerequisites | `LOCAL_BUILD_SETUP.md` | |
| 262 | +| Quick commands | `LOCAL_BUILD_QUICKSTART.md` | |
| 263 | +| Fixing issues | `LOCAL_BUILD_TROUBLESHOOTING.md` | |
| 264 | +| Understanding architecture | `LOCAL_BUILD_ARCHITECTURE.md` | |
| 265 | +| Feature comparison | `IMPLEMENTATION_SUMMARY.md` | |
| 266 | + |
| 267 | +--- |
| 268 | + |
| 269 | +## Questions? |
| 270 | + |
| 271 | +Most answers are in the documentation guides - start with `GETTING_STARTED.md` and follow the 5-step setup. |
| 272 | + |
| 273 | +If stuck, check the troubleshooting guide for your specific issue. |
| 274 | + |
| 275 | +--- |
| 276 | + |
| 277 | +## 🎉 You're Ready! |
| 278 | + |
| 279 | +Everything is set up and documented. Now: |
| 280 | + |
| 281 | +1. **Open:** [`GETTING_STARTED.md`](GETTING_STARTED.md) |
| 282 | +2. **Follow:** The setup steps |
| 283 | +3. **Build:** Your first APK without Expo charges |
| 284 | +4. **Enjoy:** Saving $240-960/year! 💰 |
| 285 | + |
| 286 | +Happy building! 📱 |
0 commit comments