Merge branch 'refactor-time-to-pause-backend' #47
This file contains 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 and release | |
on: | |
push: | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
- "pre-v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+" | |
branches: | |
- master | |
env: | |
CARGO_TERM_COLOR: always | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Prepare cargo cache | |
uses: actions/cache@v3 | |
continue-on-error: false | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
key: ${{ runner.os }}-cargo | |
restore-keys: ${{ runner.os }}-cargo | |
- uses: oven-sh/setup-bun@v2 | |
- uses: nttld/setup-ndk@v1 | |
id: setup-ndk | |
with: | |
ndk-version: r28-beta2 | |
add-to-path: false | |
- name: Set Up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
cache: 'gradle' | |
- name: Install scripts runtime | |
run: bun install | |
- name: Install cargo-ndk | |
run: | | |
cargo install --locked cargo-ndk || true | |
rustup target add aarch64-linux-android | |
- name: Build JNI | |
run: bun run build:jni | |
- name: Run tests | |
run: bun run test | |
- name: Build APK | |
if: ${{ startsWith(github.ref, 'refs/tags/v') }} || ${{ startsWith(github.ref, 'refs/tags/pre-v') }} | |
run: | | |
mkdir -p ~/.gradle | |
echo "ANDROID_NDK=$ANDROID_NDK_HOME" >> ~/.gradle/gradle.properties | |
bun run build:apk | |
env: | |
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} | |
ANDROID_SIGN_JKS: ${{ secrets.ANDROID_SIGN_JKS }} | |
ANDROID_SIGN_PASSWORD: ${{ secrets.ANDROID_SIGN_PASSWORD }} | |
- name: Upload binaries to artifacts | |
uses: actions/upload-artifact@v4 | |
if: ${{ startsWith(github.ref, 'refs/tags/pre-v') }} | |
with: | |
name: apk | |
path: | | |
artifacts/apk/*.apk | |
- name: Upload binaries to release | |
uses: svenstaro/upload-release-action@v2 | |
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: artifacts/apk/*.apk | |
tag: ${{ github.ref }} | |
overwrite: true | |
file_glob: true |