Repository navigation
191 lines (173 loc) · 6.87 KB
/
Copy pathandroid.yml
File metadata and controls
191 lines (173 loc) · 6.87 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
name: Android
on:
push:
pull_request:
workflow_dispatch:
concurrency:
group: android-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
apk:
runs-on: ubuntu-24.04
timeout-minutes: 120
env:
CI: true
CARGO_TERM_COLOR: always
GRADLE_OPTS: -Dorg.gradle.daemon=false -Dkotlin.incremental=false
steps:
- name: Checkout
uses: actions/checkout@v5
with:
submodules: recursive
- name: Checkout Tellers MTProto
uses: actions/checkout@v5
with:
repository: gdlbo/telers-mtproto-impl
path: .ci/telers-mtproto-impl
persist-credentials: false
- name: Link Tellers MTProto crate
run: |
ln -sfn "$GITHUB_WORKSPACE/.ci/telers-mtproto-impl" "$GITHUB_WORKSPACE/../telers-mtproto-impl"
test -f "$GITHUB_WORKSPACE/../telers-mtproto-impl/crates/tellers-mtproto/Cargo.toml"
- name: JDK 17
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 17
cache: gradle
- name: Android SDK
uses: android-actions/setup-android@v4
with:
packages: platform-tools
- name: Android NDK
uses: nttld/setup-ndk@v1
id: ndk
with:
ndk-version: r28c
add-to-path: false
link-to-sdk: true
- name: Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-linux-android,armv7-linux-androideabi,x86_64-linux-android
- name: Cache Rust
uses: Swatinem/rust-cache@v2
with:
workspaces: |
native/mtproto-rs
native/markup-rs
cache-targets: true
cache-all-crates: true
- name: cargo-ndk
uses: taiki-e/cache-cargo-install-action@v3
with:
tool: cargo-ndk
- name: SDK path
run: |
test -n "$ANDROID_SDK_ROOT" || echo "ANDROID_SDK_ROOT=$ANDROID_HOME" >> "$GITHUB_ENV"
echo "ANDROID_NDK_HOME=${{ steps.ndk.outputs.ndk-path }}" >> "$GITHUB_ENV"
echo "ANDROID_NDK_ROOT=${{ steps.ndk.outputs.ndk-path }}" >> "$GITHUB_ENV"
chmod +x gradlew
- name: Write signing and Firebase secrets
env:
GOOGLE_SERVICES: ${{ secrets.GOOGLE_SERVICES }}
KEYS: ${{ secrets.KEYS }}
KEYSTORE: ${{ secrets.KEYSTORE }}
run: |
set +x
if [ -n "$GOOGLE_SERVICES" ]; then
printf '%s\n' "$GOOGLE_SERVICES" > app/google-services.json
fi
if [ -n "$KEYS" ]; then
printf '%s\n' "$KEYS" > local.properties
fi
if [ -n "$KEYSTORE" ]; then
printf '%s' "$KEYSTORE" | base64 -d > release.keystore
test -s release.keystore
if [ ! -f local.properties ] || ! grep -q '^RELEASE_STORE_FILE=' local.properties; then
printf 'RELEASE_STORE_FILE=release.keystore\n' >> local.properties
fi
fi
- name: Assemble debug and release
env:
ANDROID_NDK_HOME: ${{ steps.ndk.outputs.ndk-path }}
ANDROID_NDK_ROOT: ${{ steps.ndk.outputs.ndk-path }}
run: ./gradlew --no-daemon :app:assembleDebug :app:assembleRelease
- name: Stage APKs
run: |
mkdir -p dist
cp app/build/outputs/apk/debug/monogram-*-debug.apk dist/
cp app/build/outputs/apk/release/monogram-*-release.apk dist/
ls -l dist
ls dist/monogram-universal-*-debug.apk >/dev/null
ls dist/monogram-armeabi-v7a-*-debug.apk >/dev/null
ls dist/monogram-universal-*-release.apk >/dev/null
ls dist/monogram-armeabi-v7a-*-release.apk >/dev/null
- name: Version stamp
id: ver
run: |
name=$(sed -n 's/^val appVersionName = "\(.*\)"/\1/p' app/build.gradle.kts | head -n1)
code=$(sed -n 's/^val appVersionCode = \([0-9][0-9]*\).*/\1/p' app/build.gradle.kts | head -n1)
sha=$(git rev-parse --short HEAD)
test -n "$name" && test -n "$code" && test -n "$sha"
echo "name=$name" >> "$GITHUB_OUTPUT"
echo "code=$code" >> "$GITHUB_OUTPUT"
echo "sha=$sha" >> "$GITHUB_OUTPUT"
- name: Upload debug armeabi-v7a
uses: actions/upload-artifact@v6
with:
name: monogram-debug-armeabi-v7a-${{ steps.ver.outputs.name }}-${{ steps.ver.outputs.code }}-${{ steps.ver.outputs.sha }}
path: dist/monogram-armeabi-v7a-*-debug.apk
if-no-files-found: error
retention-days: 14
- name: Upload debug arm64-v8a
uses: actions/upload-artifact@v6
with:
name: monogram-debug-arm64-v8a-${{ steps.ver.outputs.name }}-${{ steps.ver.outputs.code }}-${{ steps.ver.outputs.sha }}
path: dist/monogram-arm64-v8a-*-debug.apk
if-no-files-found: error
retention-days: 14
- name: Upload debug x86_64
uses: actions/upload-artifact@v6
with:
name: monogram-debug-x86_64-${{ steps.ver.outputs.name }}-${{ steps.ver.outputs.code }}-${{ steps.ver.outputs.sha }}
path: dist/monogram-x86_64-*-debug.apk
if-no-files-found: error
retention-days: 14
- name: Upload debug universal
uses: actions/upload-artifact@v6
with:
name: monogram-debug-universal-${{ steps.ver.outputs.name }}-${{ steps.ver.outputs.code }}-${{ steps.ver.outputs.sha }}
path: dist/monogram-universal-*-debug.apk
if-no-files-found: error
retention-days: 14
- name: Upload release armeabi-v7a
uses: actions/upload-artifact@v6
with:
name: monogram-release-armeabi-v7a-${{ steps.ver.outputs.name }}-${{ steps.ver.outputs.code }}-${{ steps.ver.outputs.sha }}
path: dist/monogram-armeabi-v7a-*-release.apk
if-no-files-found: error
retention-days: 14
- name: Upload release arm64-v8a
uses: actions/upload-artifact@v6
with:
name: monogram-release-arm64-v8a-${{ steps.ver.outputs.name }}-${{ steps.ver.outputs.code }}-${{ steps.ver.outputs.sha }}
path: dist/monogram-arm64-v8a-*-release.apk
if-no-files-found: error
retention-days: 14
- name: Upload release x86_64
uses: actions/upload-artifact@v6
with:
name: monogram-release-x86_64-${{ steps.ver.outputs.name }}-${{ steps.ver.outputs.code }}-${{ steps.ver.outputs.sha }}
path: dist/monogram-x86_64-*-release.apk
if-no-files-found: error
retention-days: 14
- name: Upload release universal
uses: actions/upload-artifact@v6
with:
name: monogram-release-universal-${{ steps.ver.outputs.name }}-${{ steps.ver.outputs.code }}-${{ steps.ver.outputs.sha }}
path: dist/monogram-universal-*-release.apk
if-no-files-found: error
retention-days: 14