|
| 1 | +# Build & Release — mobile-ide |
| 2 | + |
| 3 | +Save as BUILD_AND_RELEASE.md in the repo root (or paste into an agent). This single file includes: repo setup, local build steps, GitHub Actions workflow to scaffold/build/release an APK, keystore/signing notes, OAuth setup, runtime permissions, install instructions, and troubleshooting. Follow each numbered step. |
| 4 | + |
| 5 | +## 1) Create repository |
| 6 | +- Create a new repo on GitHub: |
| 7 | + - Owner: thenot-lab |
| 8 | + - Name: mobile-ide |
| 9 | + - Branch: main |
| 10 | + - Initialize with README (optional) |
| 11 | + |
| 12 | +## 2) Add this file and the workflow |
| 13 | +- Create these files in the repository (paths shown). You can paste them manually or use the unifile approach. |
| 14 | + - BUILD_AND_RELEASE.md (this file) |
| 15 | + - .github/workflows/scaffold-build-release.yml (workflow below) |
| 16 | + - Optionally: main.py, buildozer.spec, requirements.txt, assets/, src/ if you already have code. |
| 17 | + |
| 18 | +## 3) Minimal/Scaffold GitHub Actions workflow |
| 19 | +- Create .github/workflows/scaffold-build-release.yml with the exact contents below. This workflow will: |
| 20 | + - Scaffold a minimal Kivy app if main.py/buildozer.spec missing |
| 21 | + - Install Android SDK tools, Buildozer, build the APK |
| 22 | + - Create a GitHub Release and upload the APK |
| 23 | + - Emit a direct download URL for the APK |
| 24 | + |
| 25 | +See `.github/workflows/scaffold-build-release.yml` for the complete workflow. |
| 26 | + |
| 27 | +## 4) Trigger the build |
| 28 | +- Push to main: |
| 29 | + ```bash |
| 30 | + git add . && git commit -m "Add workflow" && git push origin main |
| 31 | + ``` |
| 32 | +- Or run Actions → Scaffold, Build & Release APK → Run workflow (workflow_dispatch). |
| 33 | + |
| 34 | +## 5) After the workflow completes |
| 35 | +- Open the workflow run; view step "Output install link" or check the job summary for: |
| 36 | + ``` |
| 37 | + https://github.com/thenot-lab/mobile-ide/releases/latest/download/<apk-file>.apk |
| 38 | + ``` |
| 39 | +- Open that URL on your Android device to download the APK. Enable "Install unknown apps" for your browser/file manager if required. Tap to install. |
| 40 | + |
| 41 | +## 6) Keystore & signed releases (recommended for distribution) |
| 42 | +- Create keystore locally: |
| 43 | + ```bash |
| 44 | + keytool -genkeypair -v -keystore my-release.keystore -alias mobileide -keyalg RSA -keysize 2048 -validity 10000 |
| 45 | + ``` |
| 46 | +- To sign in CI: |
| 47 | + - Base64-encode keystore and store secrets in repo Settings → Secrets: |
| 48 | + - ANDROID_KEYSTORE_BASE64 |
| 49 | + - KEYSTORE_PASSWORD |
| 50 | + - KEY_ALIAS |
| 51 | + - KEY_PASSWORD |
| 52 | + - Add steps to the workflow to decode keystore, place at ~/.buildozer/android/platform/android-*/ and set buildozer.spec signing config: |
| 53 | + ```ini |
| 54 | + android.release_keyalias = <alias> |
| 55 | + android.release_keystore = <path> |
| 56 | + android.release_storepass = <pass> |
| 57 | + android.release_keypass = <keypass> |
| 58 | + ``` |
| 59 | +- I can provide the workflow signing snippet on request. |
| 60 | + |
| 61 | +## 7) GitHub OAuth (GitHub login & Copilot) |
| 62 | +- Create an OAuth App: https://github.com/settings/developers → New OAuth App |
| 63 | + - Name: Mobile IDE |
| 64 | + - Homepage: https://github.com/thenot-lab/mobile-ide |
| 65 | + - Authorization callback URL: mobile-ide://auth/callback |
| 66 | +- Copy Client ID and Client Secret; do NOT commit them. |
| 67 | +- Store secrets in repo or in-app config. Implement OAuth flow inside the app via a WebView or external browser + redirect handling. |
| 68 | +- Copilot: user must have Copilot subscription. Copilot token exchange is not public—use GitHub APIs/copilot proxy per current available docs and ensure compliance with GitHub terms. |
| 69 | + |
| 70 | +## 8) Runtime storage permissions & file access |
| 71 | +- buildozer.spec includes READ/WRITE external storage. On Android 8.1 (API 27) this is enough for /sdcard access. |
| 72 | +- For Android 11+ (API 30+), scoped storage applies. Options: |
| 73 | + - Request MANAGE_EXTERNAL_STORAGE (special permission) in manifest (play store restrictions apply) and handle runtime request via Intent ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION. |
| 74 | + - Better: use Storage Access Framework (SAF) and DocumentFile APIs for file picking and read/write. |
| 75 | +- In-app: request runtime permissions using Android API or python-for-android Android modules. Prompt user on first use. |
| 76 | + |
| 77 | +## 9) Inter-app communication (Copilot/Claude) |
| 78 | +- Use Intent filters and FileProvider to share files securely. Declare intent-filters in AndroidManifest and configure provider in buildozer.spec (android.manifest_additions) if needed. |
| 79 | +- Prefer content:// URIs returned by FileProvider rather than raw filesystem paths. |
| 80 | + |
| 81 | +## 10) Local development & desktop testing |
| 82 | +- To run locally (desktop), install Python dependencies and run: |
| 83 | + ```bash |
| 84 | + python3 -m venv venv && source venv/bin/activate |
| 85 | + pip install -r requirements.txt |
| 86 | + python main.py |
| 87 | + ``` |
| 88 | + |
| 89 | +## 11) Troubleshooting (quick) |
| 90 | +- Build fails → check build logs (Actions run), search for missing system libs or dependency version conflicts. |
| 91 | +- "Timeout / disk space" errors → re-run; consider self-hosted runner for heavy builds. |
| 92 | +- App permission denied → ensure runtime permission request implemented and user granted. |
| 93 | + |
| 94 | +## 12) OAuth customization (pick one) |
| 95 | +- Add full UI, file manager, Copilot client, OAuth code: I can provide code snippets or a PR if you permit. |
| 96 | +- Add APK signing snippet to CI: provide keystore and I will show workflow changes. |
| 97 | +- Add GitHub Pages install page to present "Install" button linking to release asset. |
| 98 | + |
| 99 | +## 13) Best practices (brief) |
| 100 | +- Never commit secrets (Client Secret, keystore passwords). Use GitHub Secrets. |
| 101 | +- Use HTTPS for all network calls. |
| 102 | +- Validate and sandbox any executed code; running arbitrary code on device is risky—warn users and implement runtime limits. |
| 103 | + |
| 104 | +## 14) Contact / reproduction notes |
| 105 | +- This file targets thenot-lab/mobile-ide on branch main and the GitHub Actions runner environment ubuntu-latest (2026-01-17). Adjust PYVER, android.api, ndk and buildozer versions if you have constraints. |
| 106 | + |
| 107 | +## Next Steps |
| 108 | + |
| 109 | +If you want, I will: |
| 110 | +- (A) produce the exact keystore signing workflow snippet, |
| 111 | +- (B) generate a richer scaffold (editor+file browser+terminal) and open a PR (I will need permission to create PRs), |
| 112 | +- (C) produce a GitHub Pages install page job. |
| 113 | + |
| 114 | +Tell me which option to do next. |
0 commit comments