Skip to content

Commit

Permalink
Updated docs on android apk release builds
Browse files Browse the repository at this point in the history
  • Loading branch information
albbus-stack committed May 24, 2024
1 parent 3098186 commit 840a54d
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 5 deletions.
31 changes: 29 additions & 2 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,50 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout code
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: wasm32-unknown-unknown
override: true

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2

- name: Install Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Install Bun dependencies
run: bun install --frozen-lockfile

- name: Generate TailwindCSS
run: bun build:tailwind

- name: Install Dioxus CLI
run: cargo install dioxus-cli

- name: Create .env file
env:
API_URL: ${{ secrets.API_URL }}
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_API_KEY: ${{ secrets.SUPABASE_API_KEY }}
SUPABASE_JWT_SECRET: ${{ secrets.SUPABASE_JWT_SECRET }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
run: printf "API_URL=$API_URL\nSUPABASE_URL=$SUPABASE_URL\nSUPABASE_API_KEY=$SUPABASE_API_KEY\nSUPABASE_JWT_SECRET=$SUPABASE_JWT_SECRET\nDATABASE_URL=$DATABASE_URL\n" > .env

# TODO: Sign the APKs using a keystore

- name: Build
run: mv Cargo.toml Cargo.toml.bak && cp Cargo.mobile.toml Cargo.toml && cargo android apk build --release --split-per-abi

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: apk
path: target/aarch64-linux-android/release/t5-rs-desktop
path: gen/android/app/build/outputs/apk/**/*.apk
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@ dist/
Cargo.toml.bak

# Env
.env
.env

# Android signing
*.keystore
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ strip = true
incremental = false
```

- If you want to use Github Actions to deploy the app you should add the following secrets in the repository settings:
- If you want to use Github Actions to deploy the app (API, Web & Desktop) you should add the following secrets in the repository settings:

```text
API_URL (for the web app) -> update this after your API deployment
Expand Down Expand Up @@ -182,3 +182,20 @@ DATABASE_URL
- For Windows you can configure the `.github/workflows/windows.yaml` workflow to build and upload the `.msi` installer in the action artifacts on every push to the `master` branch or manually with the `workflow_dispatch` event.
- For Linux you can configure the `.github/workflows/linux.yaml` workflow to build and upload the `.deb` package along with the dist folder in the action artifacts on every push to the `master` branch or manually with the `workflow_dispatch` event.
- Currently `dx bundle` is being actively developed and is not yet ready for production use, so you should use `dx build` if bundling fails on other platforms (this is not good since you need attach the entire `dist` folder to your release build).

### Android

- You can build the Android app using the `bun build:android` command, this will generate various `.apk` files in the `gen/android/app/build/outputs/apk/` subfolders for each ABI.
- Generate a keystore file using the `keytool` CLI as follows:

```sh
keytool -genkey -keystore release-key.keystore -alias alias_name -keyalg RSA -validity 10000
```

- You can then sign each generated `.apk` file using the `jarsigner` CLI as follows:

```sh
jarsigner -keystore release-key.keystore ./path/to/apk alias_name
```

- After signing an `.apk` you can install the app on your device physically or using `adb install ./path/to/apk` (you should sign and install an `.apk` compatible with the ABI of your device).
2 changes: 1 addition & 1 deletion gen/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />

<application android:hasCode="true" android:supportsRtl="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme">
<application android:hasCode="true" android:supportsRtl="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" android:extractNativeLibs="true">

<activity android:configChanges="orientation|keyboardHidden" android:exported="true" android:screenOrientation="portrait" android:label="@string/app_name" android:name="com.example.t5_rs.MainActivity">
<meta-data android:name="android.app.lib_name" android:value="t5_rs" />
Expand Down

0 comments on commit 840a54d

Please sign in to comment.