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 | |
| permissions: | |
| contents: write | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| - name: Install Dependencies | |
| run: npm ci | |
| - name: Build Web App | |
| run: npm run build | |
| env: | |
| VITE_SUPABASE_URL: ${{ secrets.VITE_SUPABASE_URL }} | |
| VITE_SUPABASE_ANON_KEY: ${{ secrets.VITE_SUPABASE_ANON_KEY }} | |
| - name: Sync Capacitor | |
| run: npx cap sync | |
| - name: Update Android version | |
| run: | | |
| BUILD_NUMBER=${{ github.run_number }} | |
| sed -i "s/versionCode [0-9]*/versionCode $BUILD_NUMBER/" android/app/build.gradle | |
| sed -i "s/versionName \".*\"/versionName \"0.$BUILD_NUMBER\"/" android/app/build.gradle | |
| - name: Make gradlew executable | |
| working-directory: android | |
| run: chmod +x gradlew | |
| - name: Build Android APK | |
| working-directory: android | |
| run: ./gradlew assembleDebug | |
| - name: Upload APK | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: app-debug | |
| path: android/app/build/outputs/apk/debug/app-debug.apk | |
| - name: Create Release and Upload APK | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: beta-${{ github.run_number }} | |
| name: Beta v0.${{ github.run_number }} | |
| prerelease: true | |
| files: android/app/build/outputs/apk/debug/app-debug.apk | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |