-
Notifications
You must be signed in to change notification settings - Fork 1
144 lines (121 loc) · 4.09 KB
/
Copy pathandroid.yml
File metadata and controls
144 lines (121 loc) · 4.09 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: Build & Publish Android AAR
on:
workflow_dispatch:
inputs:
ref:
description: 'commit/tag/branch reference'
required: true
type: string
publish:
description: 'value indicating whether to publish to SonaType.'
required: true
type: boolean
default: false
jobs:
generate:
name: Generate Foreign Languages
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- name: Rust Cache
uses: Swatinem/rust-cache@v2.7.8
- name: Install Protoc
uses: arduino/setup-protoc@v3
- name: Build debug target
run: |
cargo build -p nostr-android-signer-proxy
- name: Generate Android Kotlin
run: |
cargo run -p uniffi-bindgen generate --library target/debug/libnostr_android_signer_proxy.so --config proxy/ffi/uniffi.toml --language kotlin --no-format -o target/uniffi/android-kotlin
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: android-signer-android-kotlin
path: target/uniffi/android-kotlin
build:
name: Build ${{ matrix.target }}
runs-on: ubuntu-latest
strategy:
matrix:
target:
- i686-linux-android
- armv7-linux-androideabi
- x86_64-linux-android
- aarch64-linux-android
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- name: Rust Cache
uses: Swatinem/rust-cache@v2.7.8
with:
key: ${{ matrix.target }}
- name: Install Protoc
uses: arduino/setup-protoc@v3
- name: Install cargo-ndk
run: cargo +stable install cargo-ndk
- name: Setup NDK
uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r26d
- name: Set ANDROID_NDK_HOME
run: echo "ANDROID_NDK_HOME=${{ steps.setup-ndk.outputs.ndk-path }}" >> "$GITHUB_ENV"
- name: Build library
run: cargo ndk -t ${{ matrix.target }} build --lib --release
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: android-signer-${{ matrix.target }}
path: target/${{ matrix.target }}/release/libnostr_android_signer_proxy.so
build-aar:
name: Build AAR & Publish
runs-on: ubuntu-latest
needs: [generate, build]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- uses: actions/download-artifact@v4
with:
name: android-signer-i686-linux-android
path: target/i686-linux-android/release/
- uses: actions/download-artifact@v4
with:
name: android-signer-armv7-linux-androideabi
path: target/armv7-linux-androideabi/release/
- uses: actions/download-artifact@v4
with:
name: android-signer-x86_64-linux-android
path: target/x86_64-linux-android/release/
- uses: actions/download-artifact@v4
with:
name: android-signer-aarch64-linux-android
path: target/aarch64-linux-android/release/
- uses: actions/download-artifact@v4
with:
name: android-signer-android-kotlin
path: target/uniffi/android-kotlin
- name: Assemble AAR
working-directory: proxy
run: bash assemble.sh
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: android-signer-aar
path: proxy/lib/build/outputs/aar/lib-release.aar
- name: Publish
working-directory: proxy
if: ${{ inputs.publish }}
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_TOKEN_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_TOKEN_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.MAVEN_SIGNING_SECRET_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.MAVEN_SIGNING_PASSWORD }}
run: |
./gradlew publishToMavenCentral --no-configuration-cache