-
-
Notifications
You must be signed in to change notification settings - Fork 39
348 lines (307 loc) · 13.6 KB
/
ci.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
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
name: CI
on:
push:
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
workflow_dispatch:
concurrency:
group: environment-${{ github.ref }}
cancel-in-progress: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TMDB_API_KEY: ${{ secrets.TMDB_API_KEY }}
jobs:
job-common:
runs-on: ubuntu-latest
outputs:
SHORT_SHA: ${{ steps.expose_sha.outputs.short_sha }}
steps:
- name: expose short commit sha
id: expose_sha
run: |
SHORT_SHA=${GITHUB_SHA::7}
echo "short_sha=$SHORT_SHA" >> $GITHUB_ENV
echo "SHORT_SHA=$SHORT_SHA" >> $GITHUB_OUTPUT
build-android:
if: false
needs: job-common
runs-on: ubuntu-latest
timeout-minutes: 60
env:
KEYSTORE_FILE: ${{ secrets.KEYSTORE_FILE }}
KEYSTORE_KEY_ALIAS: ${{ secrets.KEYSTORE_KEY_ALIAS }}
KEYSTORE_KEY_PASSWORD: ${{ secrets.KEYSTORE_KEY_PASSWORD }}
KEYSTORE_STORE_PASSWORD: ${{ secrets.KEYSTORE_STORE_PASSWORD }}
SHORT_SHA: ${{ needs.job-common.outputs.SHORT_SHA }}
steps:
- name: checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: setup jdk 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: cache gradle dependencies
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: gradle-${{ runner.os }}-${{ hashFiles('/*.gradle*', '/gradle-wrapper.properties') }}
restore-keys: |
gradle-${{ runner.os }}-
- name: cache gradle wrapper
uses: actions/cache@v3
with:
path: ~/.gradle/wrapper
key: gradle-wrapper-${{ runner.os }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
- name: clean outputs directory
run: rm -rf app/build/outputs/*
- name: make gradlew executable
run: chmod +x ./gradlew
- name: decode keystore file
id: decode_keystore_file
uses: timheuer/base64-to-file@v1
with:
fileName: 'keystore_release.jks'
encodedString: ${{ secrets.KEYSTORE_FILE }}
- name: set decoded file location as environment
run: echo "KEYSTORE_FILE=${{ steps.decode_keystore_file.outputs.filePath }}" >> $GITHUB_ENV
- name: assemble android gms debug artifact
run: ./gradlew androidApp:assembleGmsDebug
- name: assemble android hms debug artifact
run: ./gradlew androidApp:assembleHmsDebug
- name: assemble android foss debug artifact
run: ./gradlew androidApp:assembleFossDebug
- name: assemble android gms release artifact
run: ./gradlew androidApp:assembleGmsRelease
- name: assemble android hms release artifact
run: ./gradlew androidApp:assembleHmsRelease
- name: assemble android foss release artifact
run: ./gradlew androidApp:assembleFossRelease
- name: assemble android gms release bundle artifact
run: ./gradlew androidApp:bundleGmsRelease
- name: upload artifacts to outputs
uses: actions/upload-artifact@v4
with:
path: |
androidApp/build/outputs/apk/gms/debug
androidApp/build/outputs/apk/hms/debug
androidApp/build/outputs/apk/foss/debug
androidApp/build/outputs/apk/gms/release
androidApp/build/outputs/apk/hms/release
androidApp/build/outputs/apk/foss/release
androidApp/build/outputs/bundle/gmsRelease
- name: expose version name
id: version_name
run: |
VERSION_NAME=$(./gradlew androidApp:printVersionName -q)
echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV
- name: expose version code
id: version_code
run: |
VERSION_CODE=$(./gradlew androidApp:printVersionCode -q)
echo "VERSION_CODE=$VERSION_CODE" >> $GITHUB_ENV
- name: expose android apk paths
run: |
echo "GMS_DEBUG_APK_PATH=$(find androidApp/build/outputs/apk/gms/debug -name '*.apk' -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -d' ' -f2)" >> $GITHUB_ENV
echo "HMS_DEBUG_APK_PATH=$(find androidApp/build/outputs/apk/hms/debug -name '*.apk' -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -d' ' -f2)" >> $GITHUB_ENV
echo "FOSS_DEBUG_APK_PATH=$(find androidApp/build/outputs/apk/foss/debug -name '*.apk' -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -d' ' -f2)" >> $GITHUB_ENV
echo "GMS_RELEASE_APK_PATH=$(find androidApp/build/outputs/apk/gms/release -name '*.apk' -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -d' ' -f2)" >> $GITHUB_ENV
echo "HMS_RELEASE_APK_PATH=$(find androidApp/build/outputs/apk/hms/release -name '*.apk' -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -d' ' -f2)" >> $GITHUB_ENV
echo "FOSS_RELEASE_APK_PATH=$(find androidApp/build/outputs/apk/foss/release -name '*.apk' -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -d' ' -f2)" >> $GITHUB_ENV
echo "GMS_RELEASE_AAB_PATH=$(find androidApp/build/outputs/bundle/gmsRelease -name '*.aab' -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -d' ' -f2)" >> $GITHUB_ENV
- name: send android telegram message gms debug
env:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
THREAD_ID: ${{ secrets.TELEGRAM_THREAD_ID }}
MESSAGE: |
✅ <b>${{ env.VERSION_NAME }} (${{ env.VERSION_CODE }})</b>
<b>Ветка:</b> ${{ github.ref_name }}
<b>Коммит:</b> <code>${{ env.SHORT_SHA }}</code>
run: |
curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_TOKEN}/sendDocument" \
-F chat_id="${CHAT_ID}" \
-F document="@${{ env.GMS_DEBUG_APK_PATH }}" \
-F caption="${{ env.MESSAGE }}" \
-F message_thread_id="${THREAD_ID}" \
-F parse_mode="HTML"
- name: send android telegram message hms debug
env:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
THREAD_ID: ${{ secrets.TELEGRAM_THREAD_ID }}
MESSAGE: |
✅ <b>${{ env.VERSION_NAME }} (${{ env.VERSION_CODE }})</b>
<b>Ветка:</b> ${{ github.ref_name }}
<b>Коммит:</b> <code>${{ env.SHORT_SHA }}</code>
run: |
curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_TOKEN}/sendDocument" \
-F chat_id="${CHAT_ID}" \
-F document="@${{ env.HMS_DEBUG_APK_PATH }}" \
-F caption="${{ env.MESSAGE }}" \
-F message_thread_id="${THREAD_ID}" \
-F parse_mode="HTML"
- name: send android telegram message foss debug
env:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
THREAD_ID: ${{ secrets.TELEGRAM_THREAD_ID }}
MESSAGE: |
✅ <b>${{ env.VERSION_NAME }} (${{ env.VERSION_CODE }})</b>
<b>Ветка:</b> ${{ github.ref_name }}
<b>Коммит:</b> <code>${{ env.SHORT_SHA }}</code>
run: |
curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_TOKEN}/sendDocument" \
-F chat_id="${CHAT_ID}" \
-F document="@${{ env.FOSS_DEBUG_APK_PATH }}" \
-F caption="${{ env.MESSAGE }}" \
-F message_thread_id="${THREAD_ID}" \
-F parse_mode="HTML"
- name: send android telegram message gms release
env:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
THREAD_ID: ${{ secrets.TELEGRAM_THREAD_ID }}
MESSAGE: |
✅ <b>${{ env.VERSION_NAME }} (${{ env.VERSION_CODE }})</b>
<b>Ветка:</b> ${{ github.ref_name }}
<b>Коммит:</b> <code>${{ env.SHORT_SHA }}</code>
run: |
curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_TOKEN}/sendDocument" \
-F chat_id="${CHAT_ID}" \
-F document="@${{ env.GMS_RELEASE_APK_PATH }}" \
-F caption="${{ env.MESSAGE }}" \
-F message_thread_id="${THREAD_ID}" \
-F parse_mode="HTML"
- name: send android telegram message hms release
env:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
THREAD_ID: ${{ secrets.TELEGRAM_THREAD_ID }}
MESSAGE: |
✅ <b>${{ env.VERSION_NAME }} (${{ env.VERSION_CODE }})</b>
<b>Ветка:</b> ${{ github.ref_name }}
<b>Коммит:</b> <code>${{ env.SHORT_SHA }}</code>
run: |
curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_TOKEN}/sendDocument" \
-F chat_id="${CHAT_ID}" \
-F document="@${{ env.HMS_RELEASE_APK_PATH }}" \
-F caption="${{ env.MESSAGE }}" \
-F message_thread_id="${THREAD_ID}" \
-F parse_mode="HTML"
- name: send android telegram message foss release
env:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
THREAD_ID: ${{ secrets.TELEGRAM_THREAD_ID }}
MESSAGE: |
✅ <b>${{ env.VERSION_NAME }} (${{ env.VERSION_CODE }})</b>
<b>Ветка:</b> ${{ github.ref_name }}
<b>Коммит:</b> <code>${{ env.SHORT_SHA }}</code>
run: |
curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_TOKEN}/sendDocument" \
-F chat_id="${CHAT_ID}" \
-F document="@${{ env.FOSS_RELEASE_APK_PATH }}" \
-F caption="${{ env.MESSAGE }}" \
-F message_thread_id="${THREAD_ID}" \
-F parse_mode="HTML"
- name: send android telegram message gms release bundle
env:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
THREAD_ID: ${{ secrets.TELEGRAM_THREAD_ID }}
MESSAGE: |
✅ <b>${{ env.VERSION_NAME }} (${{ env.VERSION_CODE }})</b>
<b>Ветка:</b> ${{ github.ref_name }}
<b>Коммит:</b> <code>${{ env.SHORT_SHA }}</code>
run: |
curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_TOKEN}/sendDocument" \
-F chat_id="${CHAT_ID}" \
-F document="@${{ env.GMS_RELEASE_AAB_PATH }}" \
-F caption="${{ env.MESSAGE }}" \
-F message_thread_id="${THREAD_ID}" \
-F parse_mode="HTML"
build-desktop:
needs: job-common
runs-on: macos-latest
timeout-minutes: 60
env:
SHORT_SHA: ${{ needs.job-common.outputs.SHORT_SHA }}
steps:
- name: checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: setup jdk 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: cache gradle dependencies
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: gradle-${{ runner.os }}-${{ hashFiles('/*.gradle*', '/gradle-wrapper.properties') }}
restore-keys: |
gradle-${{ runner.os }}-
- name: cache gradle wrapper
uses: actions/cache@v3
with:
path: ~/.gradle/wrapper
key: gradle-wrapper-${{ runner.os }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
- name: assemble macos dmg artifact
run: ./gradlew :desktopApp:packageDmg
- name: "upload artifacts to outputs"
uses: actions/upload-artifact@v4
with:
name: app-mac-silicon
path: desktopApp/build/compose/binaries/main/dmg
- name: find dmg file
run: find . -name "*.dmg"
- name: expose version name
id: version_name
run: |
VERSION_NAME=$(./gradlew desktopApp:printVersionName -q)
echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV
- name: expose dmg path
run: |
DMG_PATH=$(find desktopApp/build/compose/binaries/main/dmg -name '*.dmg' | sort | tail -n 1)
echo "DMG_PATH=$DMG_PATH" >> $GITHUB_ENV
- name: send macos telegram message
env:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
THREAD_ID: ${{ secrets.TELEGRAM_THREAD_ID }}
MESSAGE: |
✅ <b>${{ env.VERSION_NAME }}</b>
<b>Ветка:</b> ${{ github.ref_name }}
<b>Коммит:</b> <code>${{ env.SHORT_SHA }}</code>
<b>.dmg URL:</b> ${{ env.DMG_PATH }}
<b><a href="${{ env.DMG_URL }}">Скачать DMG</a></b>
run: |
curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_TOKEN}/sendMessage" \
-F chat_id="${CHAT_ID}" \
-F text="${MESSAGE}" \
-F message_thread_id="${THREAD_ID}" \
-F parse_mode="HTML"
# - name: send macos telegram document
# env:
# TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
# CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
# THREAD_ID: ${{ secrets.TELEGRAM_THREAD_ID }}
# MESSAGE: |
# ✅ <b>${{ env.VERSION_NAME }} (${{ env.VERSION_CODE }})</b>
# <b>Ветка:</b> ${{ github.ref_name }}
# <b>Коммит:</b> <code>${{ env.SHORT_SHA }}</code>
# run: |
# curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_TOKEN}/sendDocument" \
# -F chat_id="${CHAT_ID}" \
# -F document="@$DMG_PATH" \
# -F caption="${{ env.MESSAGE }}" \
# -F message_thread_id="${THREAD_ID}" \
# -F parse_mode="HTML"