Update android.yml #3
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 APK | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: {} | |
| jobs: | |
| build: | |
| name: Build Release APK | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 18 | |
| - name: Setup Java (Temurin) | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: temurin | |
| java-version: 17 | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Make Gradle executable | |
| run: chmod +x ./android/gradlew | |
| - name: Create assets directory | |
| run: mkdir -p android/app/src/main/assets | |
| - name: Bundle JS assets | |
| run: | | |
| npx react-native bundle \ | |
| --platform android --dev false \ | |
| --entry-file index.js \ | |
| --bundle-output android/app/src/main/assets/index.android.bundle \ | |
| --assets-dest android/app/src/main/res | |
| - name: Build Release APK | |
| run: | | |
| cd android | |
| ./gradlew assembleRelease | |
| - name: Upload APK artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: app-release.apk | |
| path: android/app/build/outputs/apk/release/app-release.apk |