build: Update GitHub Action script #9
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: Release Android | |
| # on: | |
| # push: | |
| # tags: | |
| # - 'v*' | |
| # workflow_dispatch: | |
| jobs: | |
| build-android: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "pnpm" | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: "temurin" | |
| java-version: "17" | |
| - name: Setup Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - name: Install Android NDK | |
| run: sdkmanager "ndk;27.0.12077973" | |
| - name: Install Rust stable | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: aarch64-linux-android,armv7-linux-androideabi,x86_64-linux-android,i686-linux-android | |
| - name: Install frontend dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Initialize Android project | |
| run: pnpm tauri android init | |
| - name: Build Android APK | |
| run: pnpm tauri android build | |
| env: | |
| NDK_HOME: ${{ env.ANDROID_HOME }}/ndk/27.0.12077973 | |
| - name: Sign APK | |
| if: ${{ env.ANDROID_KEYSTORE_BASE64 != '' }} | |
| run: | | |
| echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 -d > keystore.jks | |
| $ANDROID_HOME/build-tools/34.0.0/apksigner sign \ | |
| --ks keystore.jks \ | |
| --ks-key-alias ${{ secrets.ANDROID_KEY_ALIAS }} \ | |
| --ks-pass pass:${{ secrets.ANDROID_KEYSTORE_PASSWORD }} \ | |
| --key-pass pass:${{ secrets.ANDROID_KEY_PASSWORD }} \ | |
| src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release-unsigned.apk | |
| env: | |
| ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }} | |
| - name: Upload Android artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: android-build | |
| path: src-tauri/gen/android/app/build/outputs/apk/**/*.apk |