refactor: cleanup #990
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: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| jobs: | |
| changes: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| outputs: | |
| android: ${{ steps.filter.outputs.android }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dorny/paths-filter@v3 | |
| id: filter | |
| with: | |
| filters: | | |
| android: | |
| - 'android/**' | |
| - 'assets/**' | |
| - 'lib/**' | |
| - 'pubspec.yaml' | |
| Android: | |
| needs: changes | |
| if: ${{ needs.changes.outputs.android == 'true' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: "temurin" | |
| java-version: "25" | |
| cache: "gradle" | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| channel: "stable" | |
| cache: true | |
| - name: Cache Gradle | |
| uses: actions/cache@v3 | |
| env: | |
| cache-name: cache-gradle | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/wrapper/gradle-wrapper.properties', '**/build.gradle') }} | |
| restore-keys: | | |
| ${{ runner.os }}-build-${{ env.cache-name }}- | |
| ${{ runner.os }}-build- | |
| - name: Cache Android NDK | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| /usr/local/lib/android/sdk/ndk/27.0.12077973 | |
| /usr/local/lib/android/sdk/ndk/28.2.13676358 | |
| key: ${{ runner.os }}-ndk-27-28 | |
| - name: Cache Android sdk | |
| uses: actions/cache@v3 | |
| env: | |
| cache-name: cache-Android-sdk | |
| with: | |
| path: | | |
| /usr/local/lib/android/sdk/platforms/android-31 | |
| /usr/local/lib/android/sdk/platforms/android-33 | |
| key: ${{ runner.os }}-android-platforms-${{ env.cache-name }}-${{ hashFiles('android/gradle.properties') }} | |
| restore-keys: | | |
| ${{ runner.os }}-build-${{ env.cache-name }}- | |
| ${{ runner.os }}-build- | |
| - name: Install dependencies and run build_runner | |
| run: | | |
| flutter pub get | |
| dart run build_runner build --delete-conflicting-outputs | |
| - name: Decode keystore | |
| run: | | |
| echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 --decode > android/app/my-release-key.jks | |
| - name: Create key.properties | |
| run: | | |
| cat > android/key.properties << EOF | |
| storePassword=${{ secrets.KEYSTORE_PASSWORD }} | |
| keyPassword=${{ secrets.KEY_PASSWORD }} | |
| keyAlias=${{ secrets.KEY_ALIAS }} | |
| storeFile=my-release-key.jks | |
| EOF | |
| - name: Build Release APK | |
| run: flutter build apk --release --target-platform android-arm64,android-x64 | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: DPIP-Android-Release | |
| path: build/app/outputs/flutter-apk/*.apk | |
| retention-days: 7 | |
| compression-level: 6 |