From 24a36f7f94e82a903c6cd03951257614853d31a5 Mon Sep 17 00:00:00 2001 From: TwistedUmbrellaX <1173913+AbandonedCart@users.noreply.github.com> Date: Thu, 7 Nov 2024 08:37:26 -0500 Subject: [PATCH] Create android.yml --- .github/workflows/android.yml | 87 +++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 .github/workflows/android.yml diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml new file mode 100644 index 0000000..f82e2c7 --- /dev/null +++ b/.github/workflows/android.yml @@ -0,0 +1,87 @@ +name: 'Tauri Android' + +on: + push: + branches: + - release + + workflow_dispatch: + +jobs: + publish-android: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + with: + version: 8 + + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: '17' + + - name: Setup Android SDK + uses: android-actions/setup-android@v3 + + - name: Install NDK + run: sdkmanager "ndk;27.0.11902837" + + - name: setup node + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: install Rust stable + uses: dtolnay/rust-toolchain@stable + with: + targets: aarch64-linux-android,armv7-linux-androideabi,i686-linux-android,x86_64-linux-android + + - name: Install dependencies + run: pnpm install + + - name: Initialize project + run: pnpm tauri android init + env: + NDK_HOME: ${{ env.ANDROID_HOME }}/ndk/27.0.11902837 + + - name: Build app bundle + run: pnpm tauri android build -v + env: + NDK_HOME: ${{ env.ANDROID_HOME }}/ndk/27.0.11902837 + + - name: Extract android signing key from env + run: | + echo "${{ secrets.ANDROID_RELEASE_KEYSTORE }}" > src-tauri/gen/android/release.jks.base64 + base64 -d src-tauri/gen/android/release.jks.base64 > src-tauri/gen/android/release.decrypted.jks + + - name: Sign APK + run: | + ${{ env.ANDROID_HOME }}/build-tools/34.0.0/apksigner sign --ks src-tauri/gen/android/release.decrypted.jks \ + --ks-key-alias endrl \ + --ks-pass pass:segment-editor \ + --key-pass pass:segment-editor \ + --out src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release-signed.apk \ + src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release-unsigned.apk + + - name: Get Node project version + id: package-version + uses: martinbeentjes/npm-get-version-action@v1.3.1 + + - name: Rename APK file + run: | + mv ./src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release-signed.apk ./src-tauri/gen/android/app/build/outputs/apk/universal/release/myappliation-${{ steps.package-version.outputs.current-version}}.apk + + - name: Publish + uses: softprops/action-gh-release@v1 + with: + draft: true + name: App v${{ steps.package-version.outputs.current-version}} + tag_name: v${{ steps.package-version.outputs.current-version}} + generate_release_notes: true + files: | + ./src-tauri/gen/android/app/build/outputs/apk/universal/release/myapplication-${{ steps.package-version.outputs.current-version}}.apk