android signing #4
Workflow file for this run
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 Multi Platform | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: ["master"] | |
| tags: ["v*"] | |
| jobs: | |
| build-desktop: | |
| name: Build ${{ matrix.platform.name }} | |
| runs-on: ${{ matrix.platform.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - name: linux | |
| os: ubuntu-latest | |
| build_command: flutter build linux --release | |
| artifact_path: build/linux/x64/release/bundle | |
| artifact_name: ailurus-linux | |
| - name: windows | |
| os: windows-latest | |
| build_command: flutter build windows --release | |
| artifact_path: build/windows/x64/runner/Release | |
| artifact_name: ailurus-windows | |
| - name: macos | |
| os: macos-latest | |
| build_command: flutter build macos --release | |
| artifact_path: build/macos/Build/Products/Release | |
| artifact_name: ailurus-macos | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| channel: stable | |
| cache: true | |
| - name: Install Linux dependencies | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev | |
| - name: Enable desktop targets | |
| run: | | |
| flutter config --enable-linux-desktop | |
| flutter config --enable-windows-desktop | |
| flutter config --enable-macos-desktop | |
| - name: Get dependencies | |
| run: flutter pub get | |
| - name: Build desktop app | |
| run: ${{ matrix.platform.build_command }} | |
| - name: Upload desktop artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.platform.artifact_name }} | |
| path: ${{ matrix.platform.artifact_path }} | |
| if-no-files-found: error | |
| build-android-release: | |
| name: Build signed android apk | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| environment: release | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: '17' | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| channel: stable | |
| cache: true | |
| - name: Get dependencies | |
| run: flutter pub get | |
| - name: Restore Android keystore | |
| run: | | |
| echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 -d > android/release-keystore.jks | |
| - name: Create key.properties | |
| run: | | |
| cat > android/key.properties <<EOF | |
| storePassword=${{ secrets.ANDROID_STORE_PASSWORD }} | |
| keyPassword=${{ secrets.ANDROID_KEY_PASSWORD }} | |
| keyAlias=${{ secrets.ANDROID_KEY_ALIAS }} | |
| storeFile=release-keystore.jks | |
| EOF | |
| - name: Build signed Android APK | |
| run: flutter build apk --release | |
| - name: Verify APK signature | |
| run: | | |
| BUILD_TOOLS_VERSION=$(ls "$ANDROID_HOME/build-tools" | sort -V | tail -n 1) | |
| "$ANDROID_HOME/build-tools/$BUILD_TOOLS_VERSION/apksigner" verify --print-certs build/app/outputs/flutter-apk/app-release.apk | |
| - name: Generate checksums | |
| run: | | |
| sha256sum build/app/outputs/flutter-apk/app-release.apk > build/app/outputs/flutter-apk/app-release.apk.sha256 | |
| - name: Export signing certificate details | |
| run: | | |
| BUILD_TOOLS_VERSION=$(ls "$ANDROID_HOME/build-tools" | sort -V | tail -n 1) | |
| "$ANDROID_HOME/build-tools/$BUILD_TOOLS_VERSION/apksigner" verify --print-certs build/app/outputs/flutter-apk/app-release.apk \ | |
| > build/app/outputs/flutter-apk/app-release.cert.txt | |
| - name: Upload Android artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ailurus-android-signed | |
| path: | | |
| build/app/outputs/flutter-apk/app-release.apk | |
| build/app/outputs/flutter-apk/app-release.apk.sha256 | |
| build/app/outputs/flutter-apk/app-release.cert.txt | |
| if-no-files-found: error |