feat: add native Android app with Jetpack Compose + Material 3 #52
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: [master] | |
| paths: | |
| - 'src/**' | |
| - 'APK/**' | |
| - 'package.json' | |
| - 'vite.config.ts' | |
| - '.github/workflows/build-apk.yml' | |
| pull_request: | |
| branches: [master] | |
| workflow_call: | |
| inputs: | |
| release_tag: | |
| type: string | |
| required: false | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 21 | |
| - name: Setup Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - name: Install root dependencies | |
| run: npm ci | |
| - name: Install APK dependencies | |
| working-directory: APK | |
| run: npm ci | |
| - name: Build web assets and sync Capacitor | |
| working-directory: APK | |
| run: npm run build | |
| - name: Build debug APK | |
| working-directory: APK/android | |
| run: chmod +x gradlew && ./gradlew assembleDebug | |
| - name: Upload APK artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: communauto-tools-debug | |
| path: APK/android/app/build/outputs/apk/debug/app-debug.apk | |
| retention-days: 30 | |
| - name: Rename APK with version | |
| if: inputs.release_tag | |
| run: | | |
| VERSION="${{ inputs.release_tag }}" | |
| VERSION="${VERSION#communauto-tools-v}" | |
| VERSION="${VERSION#v}" | |
| cp APK/android/app/build/outputs/apk/debug/app-debug.apk \ | |
| APK/android/app/build/outputs/apk/debug/communauto-tools-${VERSION}.apk | |
| - name: Upload APK to release | |
| if: inputs.release_tag | |
| run: gh release upload "${{ inputs.release_tag }}" APK/android/app/build/outputs/apk/debug/communauto-tools-*.apk --clobber | |
| env: | |
| GH_TOKEN: ${{ github.token }} |