-
Notifications
You must be signed in to change notification settings - Fork 175
325 lines (274 loc) · 13.8 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
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
name: Release Build
on:
push:
branches:
- master
jobs:
build-release:
name: Build Release Apk
runs-on: macos-latest
if: github.repository == 'aaa1115910/bv'
outputs:
lite_release_info_apk_filename: ${{ steps.lite-info.outputs.lite_release_info_apk_filename }}
default_release_info_version_code: ${{ steps.default-info.outputs.default_release_info_version_code }}
default_release_info_version_name: ${{ steps.default-info.outputs.default_release_info_version_name }}
changelog: ${{ steps.changelog.outputs.changelog }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: master
fetch-depth: 0
submodules: 'true'
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Write google-services.json
env:
DATA: ${{ secrets.GOOGLE_SERVICES_JSON }}
run: echo $DATA > app/google-services.json
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Add signing properties
env:
SIGNING_PROPERTIES: ${{ secrets.SIGNING_PROPERTIES }}
run: |
echo ${{ secrets.SIGNING_PROPERTIES }} > encoded_signing_properties
base64 -d encoded_signing_properties > signing.properties
- name: Add jks file
run: |
echo ${{ secrets.SIGN_KEY }} > ./encoded_key
base64 -d encoded_key > key.jks
- name: Build lite apk
run: ./gradlew assembleLiteRelease assembleLiteDebug
- name: Build default apk
run: ./gradlew assembleDefaultRelease assembleDefaultDebug
- name: Read lite release apk output metadata
id: apk-meta-lite-release
uses: juliangruber/read-file-action@v1
with:
path: app/build/outputs/apk/lite/release/output-metadata.json
- name: Read lite debug apk output metadata
id: apk-meta-lite-debug
uses: juliangruber/read-file-action@v1
with:
path: app/build/outputs/apk/lite/debug/output-metadata.json
- name: Read default release apk output metadata
id: apk-meta-default-release
uses: juliangruber/read-file-action@v1
with:
path: app/build/outputs/apk/default/release/output-metadata.json
- name: Read default debug apk output metadata
id: apk-meta-default-debug
uses: juliangruber/read-file-action@v1
with:
path: app/build/outputs/apk/default/debug/output-metadata.json
- name: Parse lite apks info
id: lite-info
run: |
echo "lite_release_info_apk_filename=${{ fromJson(steps.apk-meta-lite-release.outputs.content).elements[0].outputFile }}" >> $GITHUB_ENV
echo "lite_debug_info_apk_filename=${{ fromJson(steps.apk-meta-lite-debug.outputs.content).elements[0].outputFile }}" >> $GITHUB_ENV
echo "lite_release_info_apk_filename=${{ fromJson(steps.apk-meta-lite-release.outputs.content).elements[0].outputFile }}" >> $GITHUB_OUTPUT
- name: Parse default apks info
id: default-info
run: |
echo "default_release_info_version_code=${{ fromJson(steps.apk-meta-default-release.outputs.content).elements[0].versionCode }}" >> $GITHUB_ENV
echo "default_release_info_version_name=${{ fromJson(steps.apk-meta-default-release.outputs.content).elements[0].versionName }}" >> $GITHUB_ENV
echo "default_debug_info_version_code=${{ fromJson(steps.apk-meta-default-debug.outputs.content).elements[0].versionCode }}" >> $GITHUB_ENV
echo "default_debug_info_version_name=${{ fromJson(steps.apk-meta-default-debug.outputs.content).elements[0].versionName }}" >> $GITHUB_ENV
echo "default_release_info_version_code=${{ fromJson(steps.apk-meta-default-release.outputs.content).elements[0].versionCode }}" >> $GITHUB_OUTPUT
echo "default_release_info_version_name=${{ fromJson(steps.apk-meta-default-release.outputs.content).elements[0].versionName }}" >> $GITHUB_OUTPUT
- name: Set changelog to output
id: changelog
run: |
echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$(git log -1 --pretty=short)" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
# upload artifacts lite-debug
- name: Archive lite debug build artifacts
uses: actions/upload-artifact@v3
with:
name: Lite debug build artifact
path: app/build/outputs/apk/lite/debug/${{ env.lite_debug_info_apk_filename }}
# upload artifacts lite-release
- name: Archive lite release build artifacts
uses: actions/upload-artifact@v3
with:
name: Lite release build artifact
path: app/build/outputs/apk/lite/release/${{ env.lite_release_info_apk_filename }}
- name: Archive lite alpha build mappings
uses: actions/upload-artifact@v3
with:
name: Lite release build mappings
path: app/build/outputs/mapping/liteRelease
# upload artifacts default-debug
- name: Archive default debug build artifacts (universal)
uses: actions/upload-artifact@v3
with:
name: Default debug build artifact (universal)
path: app/build/outputs/apk/default/debug/BV_${{ env.default_debug_info_version_code }}_${{ env.default_debug_info_version_name }}_default_universal.apk
- name: Archive default debug build artifacts (armeabi-v7a)
uses: actions/upload-artifact@v3
with:
name: Default debug build artifact (armeabi-v7a)
path: app/build/outputs/apk/default/debug/BV_${{ env.default_debug_info_version_code }}_${{ env.default_debug_info_version_name }}_default_armeabi-v7a.apk
- name: Archive default debug build artifacts (arm64-v8a)
uses: actions/upload-artifact@v3
with:
name: Default debug build artifact (arm64-v8a)
path: app/build/outputs/apk/default/debug/BV_${{ env.default_debug_info_version_code }}_${{ env.default_debug_info_version_name }}_default_arm64-v8a.apk
- name: Archive default debug build artifacts (x86)
uses: actions/upload-artifact@v3
with:
name: Default debug build artifact (x86)
path: app/build/outputs/apk/default/debug/BV_${{ env.default_debug_info_version_code }}_${{ env.default_debug_info_version_name }}_default_x86.apk
- name: Archive default debug build artifacts (x86_64)
uses: actions/upload-artifact@v3
with:
name: Default debug build artifact (x86_64)
path: app/build/outputs/apk/default/debug/BV_${{ env.default_debug_info_version_code }}_${{ env.default_debug_info_version_name }}_default_x86_64.apk
# upload artifacts default-release
- name: Archive default release build mappings
uses: actions/upload-artifact@v3
with:
name: Default release build mappings
path: app/build/outputs/mapping/defaultRelease
- name: Archive default release build artifacts (universal)
uses: actions/upload-artifact@v3
with:
name: Default release build artifact (universal)
path: app/build/outputs/apk/default/release/BV_${{ env.default_release_info_version_code }}_${{ env.default_release_info_version_name }}_default_universal.apk
- name: Archive default release build artifacts (armeabi-v7a)
uses: actions/upload-artifact@v3
with:
name: Default release build artifact (armeabi-v7a)
path: app/build/outputs/apk/default/release/BV_${{ env.default_release_info_version_code }}_${{ env.default_release_info_version_name }}_default_armeabi-v7a.apk
- name: Archive default release build artifacts (arm64-v8a)
uses: actions/upload-artifact@v3
with:
name: Default release build artifact (arm64-v8a)
path: app/build/outputs/apk/default/release/BV_${{ env.default_release_info_version_code }}_${{ env.default_release_info_version_name }}_default_arm64-v8a.apk
- name: Archive default release build artifacts (x86)
uses: actions/upload-artifact@v3
with:
name: Default release build artifact (x86)
path: app/build/outputs/apk/default/release/BV_${{ env.default_release_info_version_code }}_${{ env.default_release_info_version_name }}_default_x86.apk
- name: Archive default release build artifacts (x86_64)
uses: actions/upload-artifact@v3
with:
name: Default release build artifact (x86_64)
path: app/build/outputs/apk/default/release/BV_${{ env.default_release_info_version_code }}_${{ env.default_release_info_version_name }}_default_x86_64.apk
upload-release:
name: Upload Release Apk to App Center
needs: build-release
runs-on: ubuntu-latest
steps:
# download artifacts
- name: download lite release build artifacts
uses: actions/download-artifact@v3
with:
name: Lite release build artifact
- name: download default release build artifacts (universal)
uses: actions/download-artifact@v3
with:
name: Default release build artifact (universal)
- name: download default release build artifacts (armeabi-v7a)
uses: actions/download-artifact@v3
with:
name: Default release build artifact (armeabi-v7a)
- name: download default release build artifacts (arm64-v8a)
uses: actions/download-artifact@v3
with:
name: Default release build artifact (arm64-v8a)
- name: download default release build artifacts (x86)
uses: actions/download-artifact@v3
with:
name: Default release build artifact (x86)
- name: download default release build artifacts (x86_64)
uses: actions/download-artifact@v3
with:
name: Default release build artifact (x86_64)
# upload to app center
- name: Setup app center cli
id: setup-appcenter-cli
run: npm install -g appcenter-cli
- name: Upload lite release apk to app center
id: upload-lite-release-apk
uses: nick-fields/retry@v2
with:
timeout_minutes: 1
max_attempts: 5
command: |
appcenter distribute release \
--app aaa1115910-gmail.com/BV \
--file ${{ needs.build-release.outputs.lite_release_info_apk_filename }} \
--group Public \
--token ${{ secrets.APP_CENTER_TOKEN }} \
--release-notes "${{ needs.build-release.outputs.changelog }}"
- name: Upload default release apk to app center (universal)
id: upload-default-release-apk-universal
uses: nick-fields/retry@v2
with:
timeout_minutes: 1
max_attempts: 5
command: |
appcenter distribute release \
--app aaa1115910-gmail.com/BV \
--file BV_${{ needs.build-release.outputs.default_release_info_version_code }}_${{ needs.build-release.outputs.default_release_info_version_name }}_default_universal.apk \
--group Public-universal \
--token ${{ secrets.APP_CENTER_TOKEN }} \
--release-notes "${{ needs.build-release.outputs.changelog }}"
- name: Upload default release apk to app center (armeabi-v7a)
id: upload-default-release-apk-armeabi-v7a
uses: nick-fields/retry@v2
with:
timeout_minutes: 1
max_attempts: 5
command: |
appcenter distribute release \
--app aaa1115910-gmail.com/BV \
--file BV_${{ needs.build-release.outputs.default_release_info_version_code }}_${{ needs.build-release.outputs.default_release_info_version_name }}_default_armeabi-v7a.apk \
--group Public-armeabi-v7a \
--token ${{ secrets.APP_CENTER_TOKEN }} \
--release-notes "${{ needs.build-release.outputs.changelog }}"
- name: Upload default release apk to app center (arm64-v8a)
id: upload-default-release-apk-arm64-v8a
uses: nick-fields/retry@v2
with:
timeout_minutes: 1
max_attempts: 5
command: |
appcenter distribute release \
--app aaa1115910-gmail.com/BV \
--file BV_${{ needs.build-release.outputs.default_release_info_version_code }}_${{ needs.build-release.outputs.default_release_info_version_name }}_default_arm64-v8a.apk \
--group Public-arm64-v8a \
--token ${{ secrets.APP_CENTER_TOKEN }} \
--release-notes "${{ needs.build-release.outputs.changelog }}"
- name: Upload default release apk to app center (x86)
id: upload-default-release-apk-x86
uses: nick-fields/retry@v2
with:
timeout_minutes: 1
max_attempts: 5
command: |
appcenter distribute release \
--app aaa1115910-gmail.com/BV \
--file BV_${{ needs.build-release.outputs.default_release_info_version_code }}_${{ needs.build-release.outputs.default_release_info_version_name }}_default_x86.apk \
--group Public-x86 \
--token ${{ secrets.APP_CENTER_TOKEN }} \
--release-notes "${{ needs.build-release.outputs.changelog }}"
- name: Upload default release apk to app center (x86_64)
id: upload-default-release-apk-x86_64
uses: nick-fields/retry@v2
with:
timeout_minutes: 1
max_attempts: 5
command: |
appcenter distribute release \
--app aaa1115910-gmail.com/BV \
--file BV_${{ needs.build-release.outputs.default_release_info_version_code }}_${{ needs.build-release.outputs.default_release_info_version_name }}_default_x86_64.apk \
--group Public-x86_64 \
--token ${{ secrets.APP_CENTER_TOKEN }} \
--release-notes "${{ needs.build-release.outputs.changelog }}"