Skip to content

Commit

Permalink
Create android.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
AbandonedCart committed Nov 17, 2024
1 parent 0e623dd commit 24a36f7
Showing 1 changed file with 87 additions and 0 deletions.
87 changes: 87 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]

- 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

0 comments on commit 24a36f7

Please sign in to comment.