Merge pull request #15 from codestcode/habeba #37
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: | |
| pull_request: | |
| workflow_dispatch: # Allows manual triggering of the workflow | |
| jobs: | |
| build-android: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'zulu' | |
| java-version: '21' | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v3 | |
| with: | |
| version: 9 | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Build Next.js app | |
| run: | | |
| # Move API routes out of the way because they cannot be statically exported | |
| if [ -d "app/api" ]; then | |
| mv app/api .temp-api-backup | |
| fi | |
| pnpm run build:capacitor | |
| env: | |
| NODE_ENV: production | |
| - name: Configure Capacitor for Production | |
| run: | | |
| # Remove the server block from capacitor.config.ts to bundle the web assets locally | |
| sed -i '/server:/,/}/d' capacitor.config.ts | |
| - name: Sync Capacitor Android | |
| run: | | |
| npx cap sync android | |
| - name: Build APK | |
| working-directory: ./android | |
| run: | | |
| chmod +x ./gradlew | |
| ./gradlew assembleDebug | |
| - name: Upload APK Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: app-debug | |
| path: android/app/build/outputs/apk/debug/app-debug.apk |