-
Notifications
You must be signed in to change notification settings - Fork 1
82 lines (78 loc) · 2.43 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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: Install cargo nextest
run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
- 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