Repository navigation
360 lines (313 loc) · 12.5 KB
/
Copy pathandroid.yml
File metadata and controls
360 lines (313 loc) · 12.5 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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
name: Android
on:
push:
branches:
- '**'
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
jobs:
verify:
name: Analyze and test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
with:
submodules: recursive
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
- name: Set up Node.js
uses: actions/setup-node@v5
with:
node-version: 22
cache: npm
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Install dependencies
run: flutter pub get
- name: Install Node.js dependencies
run: npm ci --ignore-scripts
- name: Analyze
run: flutter analyze
- name: Run tests
run: flutter test
- name: Test Node.js tools
run: npm run test:tools
- name: Test native bridge
working-directory: skyengine
run: cargo test -p skyengine-core -p skyengine-ffi
build-continuous:
name: Build continuous APK
runs-on: ubuntu-latest
needs: verify
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v5
with:
submodules: recursive
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-linux-android,armv7-linux-androideabi
- name: Install dependencies
run: flutter pub get
- name: Configure Android signing
env:
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
run: |
test -n "$ANDROID_KEYSTORE_BASE64"
test -n "$ANDROID_KEYSTORE_PASSWORD"
test -n "$ANDROID_KEY_ALIAS"
test -n "$ANDROID_KEY_PASSWORD"
echo "$ANDROID_KEYSTORE_BASE64" | base64 --decode > android/release.jks
{
echo "storeFile=../release.jks"
echo "storePassword=$ANDROID_KEYSTORE_PASSWORD"
echo "keyAlias=$ANDROID_KEY_ALIAS"
echo "keyPassword=$ANDROID_KEY_PASSWORD"
} > android/key.properties
- name: Verify app store credentials
env:
APP_STORE_APP_ID: ${{ secrets.APP_STORE_APP_ID }}
APP_STORE_APP_SECRET: ${{ secrets.APP_STORE_APP_SECRET }}
run: |
test -n "$APP_STORE_APP_ID"
test -n "$APP_STORE_APP_SECRET"
- name: Build and prepare release APKs
env:
APP_STORE_BASE_URL: ${{ secrets.APP_STORE_BASE_URL }}
APP_STORE_APP_ID: ${{ secrets.APP_STORE_APP_ID }}
APP_STORE_APP_SECRET: ${{ secrets.APP_STORE_APP_SECRET }}
run: |
mkdir -p dist
DART_DEFINES=(
"--dart-define=APP_STORE_APP_ID=$APP_STORE_APP_ID"
"--dart-define=APP_STORE_APP_SECRET=$APP_STORE_APP_SECRET"
)
if [ -n "$APP_STORE_BASE_URL" ]; then
DART_DEFINES+=("--dart-define=APP_STORE_BASE_URL=$APP_STORE_BASE_URL")
fi
flutter build apk --release "${DART_DEFINES[@]}" --target-platform android-arm,android-arm64 --build-name 1.0.16-continuous --build-number ${{ github.run_number }}
cp build/app/outputs/flutter-apk/app-release.apk dist/skyengine-continuous.apk
flutter build apk --release "${DART_DEFINES[@]}" --target-platform android-arm64 --build-name 1.0.16-continuous --build-number ${{ github.run_number }}
cp build/app/outputs/flutter-apk/app-release.apk dist/skyengine-continuous-arm64-v8a.apk
flutter build apk --release "${DART_DEFINES[@]}" --target-platform android-arm --build-name 1.0.16-continuous --build-number ${{ github.run_number }}
cp build/app/outputs/flutter-apk/app-release.apk dist/skyengine-continuous-armeabi-v7a.apk
- name: Upload APK artifacts
uses: actions/upload-artifact@v4
with:
name: continuous-apks
path: dist/*.apk
if-no-files-found: error
publish-continuous:
name: Upload and publish continuous APK
runs-on: ubuntu-latest
needs: build-continuous
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Download APK artifacts
uses: actions/download-artifact@v4
with:
name: continuous-apks
path: dist
- name: Move continuous tag
run: |
git tag --force continuous "$GITHUB_SHA"
git push --force origin refs/tags/continuous
- name: Update continuous release
uses: softprops/action-gh-release@v2
with:
tag_name: continuous
name: Continuous Build
prerelease: true
make_latest: false
files: |
dist/skyengine-continuous.apk
dist/skyengine-continuous-arm64-v8a.apk
dist/skyengine-continuous-armeabi-v7a.apk
build-release:
name: Build release APK
runs-on: ubuntu-latest
needs: verify
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
outputs:
version: ${{ steps.version.outputs.name }}
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
submodules: recursive
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-linux-android,armv7-linux-androideabi
- name: Install dependencies
run: flutter pub get
- name: Verify tag is on main
run: git merge-base --is-ancestor "$GITHUB_SHA" origin/main
- name: Configure Android signing
env:
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
run: |
test -n "$ANDROID_KEYSTORE_BASE64"
test -n "$ANDROID_KEYSTORE_PASSWORD"
test -n "$ANDROID_KEY_ALIAS"
test -n "$ANDROID_KEY_PASSWORD"
echo "$ANDROID_KEYSTORE_BASE64" | base64 --decode > android/release.jks
{
echo "storeFile=../release.jks"
echo "storePassword=$ANDROID_KEYSTORE_PASSWORD"
echo "keyAlias=$ANDROID_KEY_ALIAS"
echo "keyPassword=$ANDROID_KEY_PASSWORD"
} > android/key.properties
- name: Derive version
id: version
run: |
VERSION="${GITHUB_REF_NAME#v}"
echo "name=$VERSION" >> "$GITHUB_OUTPUT"
- name: Verify app store credentials
env:
APP_STORE_APP_ID: ${{ secrets.APP_STORE_APP_ID }}
APP_STORE_APP_SECRET: ${{ secrets.APP_STORE_APP_SECRET }}
run: |
test -n "$APP_STORE_APP_ID"
test -n "$APP_STORE_APP_SECRET"
- name: Build and prepare release APKs
env:
APP_STORE_BASE_URL: ${{ secrets.APP_STORE_BASE_URL }}
APP_STORE_APP_ID: ${{ secrets.APP_STORE_APP_ID }}
APP_STORE_APP_SECRET: ${{ secrets.APP_STORE_APP_SECRET }}
run: |
mkdir -p dist
DART_DEFINES=(
"--dart-define=APP_STORE_APP_ID=$APP_STORE_APP_ID"
"--dart-define=APP_STORE_APP_SECRET=$APP_STORE_APP_SECRET"
)
if [ -n "$APP_STORE_BASE_URL" ]; then
DART_DEFINES+=("--dart-define=APP_STORE_BASE_URL=$APP_STORE_BASE_URL")
fi
flutter build apk --release "${DART_DEFINES[@]}" --target-platform android-arm,android-arm64 --build-name ${{ steps.version.outputs.name }} --build-number ${{ github.run_number }}
cp build/app/outputs/flutter-apk/app-release.apk "dist/skyengine-${GITHUB_REF_NAME}.apk"
flutter build apk --release "${DART_DEFINES[@]}" --target-platform android-arm64 --build-name ${{ steps.version.outputs.name }} --build-number ${{ github.run_number }}
cp build/app/outputs/flutter-apk/app-release.apk "dist/skyengine-${GITHUB_REF_NAME}-arm64-v8a.apk"
flutter build apk --release "${DART_DEFINES[@]}" --target-platform android-arm --build-name ${{ steps.version.outputs.name }} --build-number ${{ github.run_number }}
cp build/app/outputs/flutter-apk/app-release.apk "dist/skyengine-${GITHUB_REF_NAME}-armeabi-v7a.apk"
- name: Upload APK artifacts
uses: actions/upload-artifact@v4
with:
name: release-apks
path: dist/*.apk
if-no-files-found: error
publish-release:
name: Upload and publish release APK
runs-on: ubuntu-latest
needs: build-release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set up Node.js
uses: actions/setup-node@v5
with:
node-version: 22
cache: npm
- name: Install Node.js dependencies
run: npm ci --ignore-scripts
- name: Download APK artifacts
uses: actions/download-artifact@v4
with:
name: release-apks
path: dist
- name: Publish GitHub release
uses: softprops/action-gh-release@v2
with:
name: ${{ github.ref_name }}
prerelease: false
make_latest: true
files: |
dist/skyengine-${{ github.ref_name }}.apk
dist/skyengine-${{ github.ref_name }}-arm64-v8a.apk
dist/skyengine-${{ github.ref_name }}-armeabi-v7a.apk
- name: Upload and publish universal APK
env:
QINIU_ACCESS_KEY: ${{ secrets.QINIU_ACCESS_KEY }}
QINIU_SECRET_KEY: ${{ secrets.QINIU_SECRET_KEY }}
QINIU_BUCKET: ${{ secrets.QINIU_BUCKET }}
QINIU_DOMAIN: ${{ secrets.QINIU_DOMAIN }}
MRP_SERVER: ${{ secrets.MRP_SERVER }}
MRP_ACCESS_TOKEN: ${{ secrets.MRP_ACCESS_TOKEN }}
run: |
test -n "$MRP_SERVER"
test -n "$MRP_ACCESS_TOKEN"
DOWNLOAD_URL=$(node tool/upload-file-qiniu.js "dist/skyengine-${GITHUB_REF_NAME}.apk")
test -n "$DOWNLOAD_URL"
node tool/publish_emulator_apk.js \
--download-url "$DOWNLOAD_URL" \
--fetch-file \
--architecture universal \
--version "${{ needs.build-release.outputs.version }}" \
--changelog-md CHANGELOG.MD
- name: Upload and publish arm64-v8a APK
env:
QINIU_ACCESS_KEY: ${{ secrets.QINIU_ACCESS_KEY }}
QINIU_SECRET_KEY: ${{ secrets.QINIU_SECRET_KEY }}
QINIU_BUCKET: ${{ secrets.QINIU_BUCKET }}
QINIU_DOMAIN: ${{ secrets.QINIU_DOMAIN }}
MRP_SERVER: ${{ secrets.MRP_SERVER }}
MRP_ACCESS_TOKEN: ${{ secrets.MRP_ACCESS_TOKEN }}
run: |
test -n "$MRP_SERVER"
test -n "$MRP_ACCESS_TOKEN"
DOWNLOAD_URL=$(node tool/upload-file-qiniu.js "dist/skyengine-${GITHUB_REF_NAME}-arm64-v8a.apk")
test -n "$DOWNLOAD_URL"
node tool/publish_emulator_apk.js \
--download-url "$DOWNLOAD_URL" \
--fetch-file \
--architecture arm64-v8a \
--version "${{ needs.build-release.outputs.version }}" \
--changelog-md CHANGELOG.MD
- name: Upload and publish armeabi-v7a APK
env:
QINIU_ACCESS_KEY: ${{ secrets.QINIU_ACCESS_KEY }}
QINIU_SECRET_KEY: ${{ secrets.QINIU_SECRET_KEY }}
QINIU_BUCKET: ${{ secrets.QINIU_BUCKET }}
QINIU_DOMAIN: ${{ secrets.QINIU_DOMAIN }}
MRP_SERVER: ${{ secrets.MRP_SERVER }}
MRP_ACCESS_TOKEN: ${{ secrets.MRP_ACCESS_TOKEN }}
run: |
test -n "$MRP_SERVER"
test -n "$MRP_ACCESS_TOKEN"
DOWNLOAD_URL=$(node tool/upload-file-qiniu.js "dist/skyengine-${GITHUB_REF_NAME}-armeabi-v7a.apk")
test -n "$DOWNLOAD_URL"
node tool/publish_emulator_apk.js \
--download-url "$DOWNLOAD_URL" \
--fetch-file \
--architecture armeabi-v7a \
--version "${{ needs.build-release.outputs.version }}" \
--changelog-md CHANGELOG.MD