docs(readme): map permissions to features and code #131
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Android | |
| on: | |
| push: | |
| branches: [master, ci] | |
| workflow_dispatch: | |
| inputs: | |
| profile: | |
| description: "Build profile" | |
| required: true | |
| default: "production" | |
| type: choice | |
| options: | |
| - preview | |
| - production | |
| env: | |
| JAVA_VERSION: "17" | |
| jobs: | |
| build-android: | |
| name: Build Android APK/AAB | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 45 | |
| steps: | |
| - name: 🏗 Setup repo | |
| uses: actions/checkout@v4 | |
| - name: 🏗 Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| - name: 🏗 Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version-file: ".bun-version" | |
| - name: 🏗 Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: ${{ env.JAVA_VERSION }} | |
| distribution: "temurin" | |
| cache: "gradle" | |
| - name: 🏗 Setup Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - name: 🏗 Setup EAS | |
| uses: expo/expo-github-action@v8 | |
| with: | |
| eas-version: latest | |
| packager: "bun" | |
| token: ${{ secrets.EXPO_TOKEN }} | |
| - name: 📦 Cache dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| node_modules | |
| ~/.bun/install/cache | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| ~/.android/build-cache | |
| key: ${{ runner.os }}-deps-${{ hashFiles('bun.lockb', 'package.json', 'android/**/*.gradle*') }} | |
| restore-keys: | | |
| ${{ runner.os }}-deps- | |
| - name: 📦 Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: 🔧 Set Build Profile and Environment | |
| id: config | |
| run: | | |
| PROFILE=${{ github.event.inputs.profile || 'preview' }} | |
| echo "profile=$PROFILE" >> $GITHUB_OUTPUT | |
| # Set Android environment variables | |
| echo "ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" >> $GITHUB_ENV | |
| echo "JAVA_HOME=$JAVA_HOME_17_X64" >> $GITHUB_ENV | |
| # Determine build type from profile | |
| if [ "$PROFILE" == "production" ]; then | |
| echo "build_type=aab" >> $GITHUB_OUTPUT | |
| echo "artifact_pattern=*.aab" >> $GITHUB_OUTPUT | |
| else | |
| echo "build_type=apk" >> $GITHUB_OUTPUT | |
| echo "artifact_pattern=*.apk" >> $GITHUB_OUTPUT | |
| fi | |
| - name: 🚀 Build Android Locally | |
| id: build | |
| run: | | |
| PROFILE=${{ steps.config.outputs.profile }} | |
| BUILD_TYPE=${{ steps.config.outputs.build_type }} | |
| echo "Building locally with profile: $PROFILE" | |
| echo "Build type: $BUILD_TYPE" | |
| # Run EAS build locally | |
| eas build \ | |
| --local \ | |
| --platform android \ | |
| --profile $PROFILE \ | |
| --non-interactive \ | |
| --output ./build-output.$BUILD_TYPE | |
| # Get build details | |
| echo "build_output=./build-output.$BUILD_TYPE" >> $GITHUB_OUTPUT | |
| echo "build_size=$(du -h ./build-output.$BUILD_TYPE | cut -f1)" >> $GITHUB_OUTPUT | |
| # Generate build ID for tracking | |
| BUILD_ID="local-$(date +%Y%m%d%H%M%S)-$(git rev-parse --short HEAD)" | |
| echo "build_id=$BUILD_ID" >> $GITHUB_OUTPUT | |
| env: | |
| EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }} | |
| - name: 📊 Verify Build Output | |
| run: | | |
| BUILD_OUTPUT="${{ steps.build.outputs.build_output }}" | |
| if [ -f "$BUILD_OUTPUT" ]; then | |
| echo "✅ Build successful!" | |
| echo "📦 File: $BUILD_OUTPUT" | |
| echo "📏 Size: ${{ steps.build.outputs.build_size }}" | |
| echo "🔍 Type: $(file -b "$BUILD_OUTPUT")" | |
| # Additional verification for APK/AAB | |
| if [[ "$BUILD_OUTPUT" == *.apk ]]; then | |
| # Basic APK verification | |
| unzip -l "$BUILD_OUTPUT" | head -10 | |
| elif [[ "$BUILD_OUTPUT" == *.aab ]]; then | |
| # Basic AAB verification | |
| unzip -l "$BUILD_OUTPUT" | head -10 | |
| fi | |
| else | |
| echo "❌ Build failed - no output file found" | |
| exit 1 | |
| fi | |
| - name: 📤 Upload Build Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: android-${{ steps.config.outputs.build_type }}-${{ steps.config.outputs.profile }}-${{ github.sha }} | |
| path: ${{ steps.build.outputs.build_output }} | |
| retention-days: 7 | |
| compression-level: 6 | |
| - name: 📋 Comment Build Status (PR) | |
| if: github.event_name == 'pull_request' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const profile = '${{ steps.config.outputs.profile }}'; | |
| const buildType = '${{ steps.config.outputs.build_type }}'; | |
| const buildSize = '${{ steps.build.outputs.build_size }}'; | |
| const sha = context.sha.substring(0, 7); | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: `🤖 Android build completed successfully!\n\n**Profile:** ${profile}\n**Type:** ${buildType.toUpperCase()}\n**Size:** ${buildSize}\n**Commit:** ${sha}\n\n📦 Build artifact has been uploaded and is available in the workflow run artifacts.` | |
| }) | |
| - name: 📤 Upload build logs (on failure) | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-logs-${{ github.sha }} | |
| path: | | |
| ~/.expo/eas-build-local-nodejs/**/*.log | |
| android/app/build/outputs/logs | |
| retention-days: 3 |