-
Notifications
You must be signed in to change notification settings - Fork 0
349 lines (303 loc) · 10.9 KB
/
apple.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
349
name: Apple Pen
on:
repository_dispatch:
types:
- ppap
- v*
env:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
REF_NAME: ${{ github.event.client_payload.ref_name }}
TRIGGERING_ACTOR: ${{ github.event.client_payload.triggering_actor }}
MAIN_REPOSITORY: ${{ secrets.CUCU_REPOSITORY }}
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_GROUP_ID: ${{ vars.TELEGRAM_GROUP_ID }}
TELEGRAM_TOPIC_ID: ${{ vars.TELEGRAM_TOPIC_ID }}
API_KEY_JSON: ${{ secrets.API_KEY_JSON }}
PRO_API_KEY_JSON: ${{ secrets.PRO_API_KEY_JSON }}
PRO_PLAY_STORE_KEY_JSON: ${{ secrets.PRO_PLAY_STORE_KEY_JSON }}
RELEASE_KEYSTORE_BASE64: ${{ secrets.RELEASE_KEYSTORE_BASE64 }}
DYNAMIC_CONSTANTS_TS_PROD_BASE64: ${{ secrets.CUCU_DYNAMIC_CONSTANTS_TS_PROD_BASE64 }}
PRO_GOOGLE_SERVICES_JSON: ${{ secrets.CUCU_PRO_GOOGLE_SERVICES_JSON }}
PRO_GOOGLESERVICE_INFO_PLIST: ${{ secrets.CUCU_PRO_GOOGLESERVICE_INFO_PLIST }}
jobs:
init:
name: Init
runs-on: macos-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.value }}
message-information: ${{ steps.get-message-information.outputs.value }}
env: ${{ steps.set-env.outputs.value }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: ${{ env.MAIN_REPOSITORY }}
token: ${{ secrets.GH_PAT }}
ref: ${{ github.event.client_payload.ref_name}}
- name: Set matrix
id: set-matrix
run: |
MATRIX="[{\"format\":\"IPA\",\"name\":\"macos-14\",\"platform\":\"IOS\"},{\"format\":\"APK\",\"name\":\"ubuntu-22.04\",\"platform\":\"ANDROID\"}]"
if [[ "$REF_NAME" =~ "prd" ]]; then
MATRIX="[{\"format\":\"IPA\",\"name\":\"macos-14\",\"platform\":\"IOS\"},{\"format\":\"APK\",\"name\":\"ubuntu-22.04\",\"platform\":\"ANDROID\"},{\"format\":\"AAB\",\"name\":\"ubuntu-22.04\",\"platform\":\"ANDROID\"}]"
fi
echo "value=$MATRIX" >> $GITHUB_OUTPUT
- name: Set env
id: set-env
run: |
ENV='dev'
if [[ "$REF_NAME" =~ "prd" ]]; then
ENV='prd'
elif [[ "$REF_NAME" =~ "stg" ]]; then
ENV='stg'
fi
echo "value=$ENV" >> $GITHUB_OUTPUT
- name: Generate message
id: get-message-information
run: |
source .github/scripts/utils.sh
echo "value=$(get_message_information)" >> "$GITHUB_OUTPUT"
timeout-minutes: 1
- name: Log value
run: |
echo "tag-source: $REF_NAME"
echo "matrix: ${{ steps.set-matrix.outputs.value }}"
echo "message-information: ${{ steps.get-message-information.outputs.value }}"
echo "env: ${{ steps.set-env.outputs.value }}"
- name: Send telegram message
if: vars.IS_SILENT != 'true'
uses: PacificPromise/macos-telegram-action@main
with:
type: topic
message: '🎬 - Start build: ${{ steps.get-message-information.outputs.value }}'
prepare:
name: Prepare ${{ matrix.platform }}
continue-on-error: true
needs: [init]
strategy:
fail-fast: true
matrix:
include:
- name: 'macos-latest'
platform: 'IOS'
- name: 'ubuntu-22.04'
platform: 'ANDROID'
runs-on: ${{ matrix.name }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: ${{ env.MAIN_REPOSITORY }}
token: ${{ secrets.GH_PAT }}
ref: ${{ github.event.client_payload.ref_name}}
- name: Setup Node v18
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ matrix.platform }}-cache-node-modules-v2-${{ hashFiles('yarn.lock') }}
lookup-only: true
- name: Unlock ssh agent
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY_SDK_CORE_CLIENT }}
- name: Run yarn install
if: steps.cache-node-modules.outputs.cache-hit != 'true'
uses: borales/actions-yarn@v5
with:
cmd: install --network-concurrency 1
- name: Send telegram message failure
if: ${{ failure() && vars.IS_SILENT != 'true' }}
uses: PacificPromise/macos-telegram-action@main
with:
type: topic
message: '💥 - Failure ${{ matrix.platform }}: ${{ needs.init.outputs.message-information }}'
deploy:
name: Deployment ${{ matrix.format }}
continue-on-error: true
strategy:
fail-fast: true
matrix:
include: ${{ fromJson(needs.init.outputs.matrix) }}
runs-on: ${{ matrix.name }}
needs: [init, prepare]
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: ${{ env.MAIN_REPOSITORY }}
token: ${{ secrets.GH_PAT }}
ref: ${{ github.event.client_payload.ref_name}}
# NOTE: setup environment
- name: Setup ruby 3.2.2
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2.2'
bundler-cache: true
- name: Setup Node v18
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Set up JDK 17
uses: actions/setup-java@v4
if: matrix.platform == 'ANDROID'
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'
- name: Setup Android SDK
if: matrix.platform == 'ANDROID'
uses: android-actions/setup-android@v3
- name: Setup Android NDK
uses: nttld/setup-ndk@v1
if: matrix.platform == 'ANDROID'
with:
ndk-version: r26c
- name: Setup cocoapods
if: matrix.platform == 'IOS'
uses: maxim-lobanov/setup-cocoapods@v1
with:
version: 1.15.2
# - name: Select Xcode
# if: matrix.platform == 'IOS'
# uses: maxim-lobanov/setup-xcode@v1
# with:
# xcode-version: '16.0'
# NOTE: install libs
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ matrix.platform }}-cache-node-modules-v2-${{ hashFiles('yarn.lock') }}
- name: Cache Pods
if: matrix.platform == 'IOS'
id: cache-pods
uses: actions/cache@v4
with:
path: |
ios/Pods
ios/Podfile.lock
key: cache-pods-v2-${{ hashFiles('yarn.lock') }}
- name: Pod install
if: matrix.platform == 'IOS'
working-directory: ios
run: pod install
- name: Cache Xcode build
uses: irgaly/xcode-cache@v1
if: matrix.platform == 'IOS'
with:
key: xcode-cache-deriveddata-${{ needs.init.outputs.env }}-${{ hashFiles('yarn.lock') }}
restore-keys: xcode-cache-deriveddata-${{ needs.init.outputs.env }}-
# NOTE: load environment and file
- name: Load secret files
run: bash .github/scripts/load_secret_file.sh
- name: Change version and build number
run: bash .github/scripts/change_version_and_build_number.sh
- name: Config environment
run: bash .github/scripts/config_environment.sh
- name: Generate launcher icon
uses: borales/actions-yarn@v5
with:
cmd: appicon:create
- name: Remove File
uses: JesseTG/[email protected]
with:
path: ios/.xcode.env.local
continue-on-error: true
- name: Install certificate and provision
if: matrix.platform == 'IOS'
run: bash .github/scripts/install_cert_and_provision.sh
- name: Link Node (/usr/local/bin/node)
if: matrix.platform == 'IOS'
run: ln -s $(command -v node) /usr/local/bin/node
- name: Set permissions for node_modules
run: sudo chmod -R 777 node_modules
# NOTE: start build
- name: Build IPA
if: matrix.format == 'IPA'
uses: maierj/[email protected]
with:
lane: 'ios ipa'
- name: Build APK
if: matrix.format == 'APK'
uses: borales/actions-yarn@v5
with:
cmd: release:android --warning-mode all
- name: Build AAB
if: matrix.format == 'AAB'
uses: borales/actions-yarn@v5
with:
cmd: release:play
# NOTE: deploy
- name: Deploy ipa
if: matrix.format == 'IPA'
uses: maierj/[email protected]
with:
lane: ios testflight
- name: Deploy APK to firebase
if: matrix.format == 'APK'
uses: maierj/[email protected]
with:
lane: android beta
- name: Deploy AAB to playstore
if: matrix.format == 'AAB'
uses: maierj/[email protected]
with:
lane: android upload_to_open_testing_play_store
- name: Send telegram message
if: vars.IS_SILENT != 'true'
uses: PacificPromise/macos-telegram-action@main
with:
type: topic
message: '✅ - Success ${{ matrix.format }}: ${{ needs.init.outputs.message-information }}'
- name: Send telegram message failure
if: ${{ failure() && vars.IS_SILENT != 'true' }}
uses: PacificPromise/macos-telegram-action@main
with:
type: topic
message: '💥 - Failure ${{ matrix.format }}: ${{ needs.init.outputs.message-information }}'
after-deploy:
needs: [deploy]
name: After Deployment
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: ${{ env.MAIN_REPOSITORY }}
token: ${{ secrets.GH_PAT }}
ref: ${{ github.event.client_payload.ref_name }}
- name: Get environment full
uses: dkershner6/switch-case-action@v1
id: get-environment
with:
default: 'debug'
conditionals-with-values: |
${{ contains(github.event.client_payload.ref_name, 'prd') }} => production
${{ contains(github.event.client_payload.ref_name, 'stg') }} => staging
${{ contains(github.event.client_payload.ref_name, 'dev') }} => development
- name: Get version and build number
id: get-version-sentry
run: |
source .github/scripts/utils.sh
echo "value=$(get_sentry_version)" >> "$GITHUB_OUTPUT"
timeout-minutes: 1
- name: Create Sentry release
uses: getsentry/action-release@v1
if: ${{ steps.get-environment.outputs.value != 'debug' }}
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
set_commits: skip
environment: ${{ steps.get-environment.outputs.value }}
version: ${{ steps.get-version-sentry.outputs.value }}