Build Final Flutter App #5
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 Final Flutter App | |
| on: workflow_dispatch | |
| jobs: | |
| build_android: | |
| name: Build Android APKs | |
| runs-on: ubuntu-latest | |
| env: | |
| KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
| KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
| KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Java | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '22' | |
| - uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: '3.38.5' | |
| - run: flutter pub get | |
| - name: Decode Keystore | |
| run: | | |
| echo "${{ secrets.KEYSTORE }}" | base64 --decode > android/app/keystore.jks | |
| # Build split APKs per ABI | |
| - name: Build APK (arm64-v8a) | |
| run: flutter build apk --release --split-per-abi --target-platform android-arm64 | |
| env: | |
| KEYSTORE_FILE: keystore.jks | |
| KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
| KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
| KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
| - name: Build APK (armeabi-v7a) | |
| run: flutter build apk --release --split-per-abi --target-platform android-arm | |
| env: | |
| KEYSTORE_FILE: keystore.jks | |
| KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
| KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
| KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
| - name: Build APK (x86_64) | |
| run: flutter build apk --release --split-per-abi --target-platform android-x64 | |
| env: | |
| KEYSTORE_FILE: keystore.jks | |
| KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
| KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
| KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
| # Also build universal APK as fallback | |
| - name: Build Universal APK | |
| run: flutter build apk --release | |
| env: | |
| KEYSTORE_FILE: keystore.jks | |
| KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
| KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
| KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
| - name: Verify APK signatures | |
| run: | | |
| jarsigner -verify -verbose -certs build/app/outputs/flutter-apk/app-arm64-v8a-release.apk | |
| jarsigner -verify -verbose -certs build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk | |
| jarsigner -verify -verbose -certs build/app/outputs/flutter-apk/app-x86_64-release.apk | |
| jarsigner -verify -verbose -certs build/app/outputs/flutter-apk/app-release.apk | |
| - name: List APK Directory | |
| run: ls -alh ${{ github.workspace }}/build/app/outputs/flutter-apk | |
| - name: Upload APKs | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: android-apks | |
| path: ${{ github.workspace }}/build/app/outputs/flutter-apk/*.apk | |
| build_windows: | |
| name: Build Windows | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: '3.38.5' | |
| - run: flutter pub get | |
| - run: flutter build windows | |
| - name: List Windows Build Directory | |
| run: dir ${{ github.workspace }}/build/windows/x64/runner/Release | |
| - name: Zip Windows Build | |
| run: | | |
| cd ${{ github.workspace }}/build/windows/x64/runner/Release | |
| powershell -Command "Compress-Archive -Path * -DestinationPath rdnbenet-windows.zip" | |
| - name: Upload Windows Build | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-zip | |
| path: ${{ github.workspace }}/build/windows/x64/runner/Release/rdnbenet-windows.zip | |
| build_linux: | |
| name: Build Linux | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: '3.38.5' | |
| - run: sudo apt-get update | |
| - run: sudo apt-get install -y ninja-build cmake libgtk-3-dev | |
| - run: flutter pub get | |
| - run: flutter build linux | |
| - name: List Linux Build Directory | |
| run: ls -alh ${{ github.workspace }}/build/linux/x64/release/bundle | |
| - name: Zip Linux Build | |
| run: | | |
| cd ${{ github.workspace }}/build/linux/x64/release/bundle | |
| zip -r rdnbenet-linux-x64.zip * | |
| - name: Upload Linux Build | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-zip | |
| path: ${{ github.workspace }}/build/linux/x64/release/bundle/rdnbenet-linux-x64.zip | |
| upload-release: | |
| permissions: write-all | |
| needs: [build_android, build_linux, build_windows] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Read version from pubspec.yaml | |
| id: version | |
| run: | | |
| VERSION=$(grep 'version:' pubspec.yaml | sed 's/version: //') | |
| echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Download Android APKs | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: android-apks | |
| path: ./out/android | |
| - name: Download Windows ZIP | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: windows-zip | |
| path: ./out/windows | |
| - name: Download Linux ZIP | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: linux-zip | |
| path: ./out/linux | |
| - name: List output directory | |
| run: ls -R ./out | |
| - name: Upload Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| ./out/android/*.apk | |
| ./out/windows/* | |
| ./out/linux/* | |
| tag_name: ${{ steps.version.outputs.VERSION }} | |
| draft: false | |
| prerelease: false |