@@ -23,25 +23,48 @@ jobs:
23
23
with :
24
24
fetch-depth : 0
25
25
# Cache Flutter dependencies
26
- # - uses: actions/cache@v4
27
- # with:
28
- # path: |
29
- # ~/.pub-cache
30
- # build/
31
- # .dart_tool/
32
- # key: ${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }}
33
- # restore-keys: |
34
- # ${{ runner.os }}-flutter-
26
+ - name : Cache Flutter dependencies (normal)
27
+ if : ${{ !contains(github.event.head_commit.message, '[clean]') }}
28
+ uses : actions/cache@v4
29
+ with :
30
+ path : |
31
+ ~/.pub-cache
32
+ build/
33
+ .dart_tool/
34
+ key : v1-${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }}
35
+ restore-keys : |
36
+ v1-${{ runner.os }}-flutter-
37
+ clean-v1-${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }}
38
+ - name : Cache Flutter dependencies (clean)
39
+ if : contains(github.event.head_commit.message, '[clean]')
40
+ uses : actions/cache@v4
41
+ with :
42
+ path : |
43
+ ~/.pub-cache
44
+ build/
45
+ .dart_tool/
46
+ key : clean-v1-${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }}
35
47
36
48
# Cache Gradle dependencies
37
- # - uses: actions/cache@v4
38
- # with:
39
- # path: |
40
- # ~/.gradle/caches
41
- # ~/.gradle/wrapper
42
- # key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
43
- # restore-keys: |
44
- # ${{ runner.os }}-gradle-
49
+ - name : Cache Gradle dependencies (normal)
50
+ if : ${{!contains(github.event.head_commit.message, '[clean]')}}
51
+ uses : actions/cache@v4
52
+ with :
53
+ path : |
54
+ ~/.gradle/caches
55
+ ~/.gradle/wrapper
56
+ key : v1-${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
57
+ restore-keys : |
58
+ v1-${{ runner.os }}-gradle-
59
+ clean-v1-${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
60
+ - name : Cache Gradle dependencies (clean)
61
+ if : contains(github.event.head_commit.message, '[clean]')
62
+ uses : actions/cache@v4
63
+ with :
64
+ path : |
65
+ ~/.gradle/caches
66
+ ~/.gradle/wrapper
67
+ key : clean-v1-${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
45
68
# Setup Cmake
46
69
- name : Setup cmake
47
70
uses : jwlawson/actions-setup-cmake@v2
@@ -184,10 +207,31 @@ jobs:
184
207
185
208
# Setup Flutter with caching
186
209
- name : Setup Flutter
210
+ id : setup-flutter
187
211
uses : subosito/flutter-action@v2
188
212
with :
189
213
flutter-version : 3.32.5
190
- cache : true
214
+ - name : Cache Flutter dependencies (normal)
215
+ if : ${{!contains(github.event.head_commit.message, '[clean]')}}
216
+ uses : actions/cache@v4
217
+ with :
218
+ path : |
219
+ ${{ steps.setup-flutter.outputs.pub-cache-path }}
220
+ build
221
+ .dart_tool
222
+ key : v1-${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }}
223
+ restore-keys : |
224
+ v1-${{ runner.os }}-flutter-
225
+ clean-v1-${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }}
226
+ - name : Cache Flutter dependencies (clean)
227
+ if : contains(github.event.head_commit.message, '[clean]')
228
+ uses : actions/cache@v4
229
+ with :
230
+ path : |
231
+ ${{ steps.setup-flutter.outputs.pub-cache-path }}
232
+ build
233
+ .dart_tool
234
+ key : clean-v1-${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }}
191
235
- name : Setup NuGet.exe for use with actions
192
236
uses : NuGet/setup-nuget@v2.0.1
193
237
with :
@@ -251,15 +295,25 @@ jobs:
251
295
sudo apt-get install -y ninja-build libgtk-3-dev webkit2gtk-4.1 libmpv-dev pkg-config fuse
252
296
253
297
# Step 4: Cache Flutter dependencies
254
- # - name: Cache Flutter dependencies
255
- # uses: actions/cache@v3
256
- # with:
257
- # path: |
258
- # ~/.pub-cache
259
- # build/
260
- # key: ${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.yaml') }}
261
- # restore-keys: |
262
- # ${{ runner.os }}-flutter-
298
+ - name : Cache Flutter dependencies (normal)
299
+ if : ${{!contains(github.event.head_commit.message, '[clean]')}}
300
+ uses : actions/cache@v4
301
+ with :
302
+ path : |
303
+ ~/.pub-cache
304
+ build/
305
+ key : v1-${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.yaml') }}
306
+ restore-keys : |
307
+ v1-${{ runner.os }}-flutter-
308
+ clean-v1-${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.yaml') }}
309
+ - name : Cache Flutter dependencies (clean)
310
+ if : contains(github.event.head_commit.message, '[clean]')
311
+ uses : actions/cache@v4
312
+ with :
313
+ path : |
314
+ ~/.pub-cache
315
+ build/
316
+ key : clean-v1-${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.yaml') }}
263
317
# Create .env:
264
318
- name : Setup env File
265
319
env :
@@ -308,10 +362,31 @@ jobs:
308
362
309
363
# Step 2: Setup Flutter
310
364
- name : Setup Flutter
365
+ id : setup-flutter
311
366
uses : subosito/flutter-action@v2
312
367
with :
313
368
flutter-version : 3.32.5
314
- cache : true
369
+ - name : Cache Flutter dependencies (normal)
370
+ if : ${{!contains(github.event.head_commit.message, '[clean]')}}
371
+ uses : actions/cache@v4
372
+ with :
373
+ path : |
374
+ ${{ steps.setup-flutter.outputs.pub-cache-path }}
375
+ build
376
+ .dart_tool
377
+ key : v1-${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }}
378
+ restore-keys : |
379
+ v1-${{ runner.os }}-flutter-
380
+ clean-v1-${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }}
381
+ - name : Cache Flutter dependencies (clean)
382
+ if : contains(github.event.head_commit.message, '[clean]')
383
+ uses : actions/cache@v4
384
+ with :
385
+ path : |
386
+ ${{ steps.setup-flutter.outputs.pub-cache-path }}
387
+ build
388
+ .dart_tool
389
+ key : clean-v1-${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }}
315
390
316
391
- name : Setup .env File for macOS
317
392
env :
@@ -329,18 +404,20 @@ jobs:
329
404
run : |
330
405
flutter build ios --release --no-codesign
331
406
cd build/ios/iphoneos
407
+ # Remove old Payload directory to avoid cp error on cached runs
408
+ rm -rf Payload
332
409
mkdir -p Payload
333
410
cd Payload
334
- ln -s ../Runner.app
411
+ cp -R ../Runner.app .
335
412
cd ..
336
413
zip -r Dartotsu-iOS-${{ github.ref_name }}.ipa Payload
337
414
# Step 5 Upload ipa file to google drive
338
415
- name : Upload File To Google Drive
339
416
id : gdriveUpload
340
417
uses : hoatruongdev09/google-drive-file-upload-github-action@v1.1
341
418
with :
342
- file-path : build/ios/iphoneos/Dartotsu-iOS-main .ipa
343
- upload-name : Dartotsu-iOS-main .ipa
419
+ file-path : build/ios/iphoneos/Dartotsu-iOS-${{github.ref_name}} .ipa
420
+ upload-name : Dartotsu-iOS-${{github.ref_name}} .ipa
344
421
upload-to-folder-id : ${{secrets.GOOGLE_FOLDER_MAIN}}
345
422
service-account-json : " ${{secrets.GOOGLE_KEY}}"
346
423
overrwrite : true
@@ -358,10 +435,31 @@ jobs:
358
435
uses : actions/checkout@v4
359
436
360
437
- name : Setup Flutter
438
+ id : setup-flutter
361
439
uses : subosito/flutter-action@v2
362
440
with :
363
441
flutter-version : 3.32.5
364
- cache : true
442
+ - name : Cache Flutter dependencies (normal)
443
+ if : ${{!contains(github.event.head_commit.message, '[clean]')}}
444
+ uses : actions/cache@v4
445
+ with :
446
+ path : |
447
+ ${{ steps.setup-flutter.outputs.pub-cache-path }}
448
+ build
449
+ .dart_tool
450
+ key : v1-${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }}
451
+ restore-keys : |
452
+ v1-${{ runner.os }}-flutter-
453
+ clean-v1-${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }}
454
+ - name : Cache Flutter dependencies (clean)
455
+ if : contains(github.event.head_commit.message, '[clean]')
456
+ uses : actions/cache@v4
457
+ with :
458
+ path : |
459
+ ${{ steps.setup-flutter.outputs.pub-cache-path }}
460
+ build
461
+ .dart_tool
462
+ key : clean-v1-${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }}
365
463
- name : Setup .env File for macOS
366
464
env :
367
465
SIMKL_SECRET : ${{ secrets.SIMKL_SECRET }}
@@ -420,8 +518,8 @@ jobs:
420
518
COMMIT_LOGS=$(git log $LAST_SHA..HEAD --pretty=format:"● %s ~%an [֍](https://github.com/${{ github.repository }}/commit/%H)" --max-count=10)
421
519
# URL-encode the newline characters for GitHub Actions
422
520
COMMIT_LOGS="${COMMIT_LOGS//'%'/'%25'}"
423
- COMMIT_LOGS="${COMMIT_LOGS//$'\n '/'%0A'}"
424
- COMMIT_LOGS="${COMMIT_LOGS//$'\r '/'%0D'}"
521
+ COMMIT_LOGS="${COMMIT_LOGS//'/'%0A'}"
522
+ COMMIT_LOGS="${COMMIT_LOGS//'/'%0D'}"
425
523
# Append the encoded commit logs to the COMMIT_LOG environment variable
426
524
echo "COMMIT_LOG=${COMMIT_LOGS}" >> $GITHUB_ENV
427
525
# Debugging: Print the variable to check its content
@@ -655,13 +753,7 @@ jobs:
655
753
-F "chat_id=${{ secrets.TELEGRAM_CHANNEL_ID}}" \
656
754
-F "message_thread_id=${{secrets.TELEGRAM_THREAD_ID}}" \
657
755
-F "document=@last_sha.txt" \
658
- -F "caption=New Alpha-Build dropped 🔥
659
-
660
- Commits:
661
- ${telegram_commit_messages}
662
- Devs:
663
- ${telegram_dev_info}
664
- version: ${VERSION}" \
756
+ -F "caption=New Alpha-Build dropped 🔥\n\n Commits:\n ${telegram_commit_messages}\n Devs:\n ${telegram_dev_info}\n version: ${VERSION}" \
665
757
-F "parse_mode=HTML")
666
758
667
759
- name : Upload Current SHA as Artifact
@@ -728,31 +820,26 @@ jobs:
728
820
MESSAGE="🎉 *Build Notification* 🎉"
729
821
730
822
if [[ -n "${{ env.apk_message }}" ]]; then
731
- MESSAGE="$MESSAGE
732
- ${{ env.apk_message }}"
823
+ MESSAGE="$MESSAGE\n ${{ env.apk_message }}"
733
824
fi
734
825
if [[ -n "${{ env.windows_message }}" ]]; then
735
- MESSAGE="$MESSAGE
736
- ${{ env.windows_message }}"
826
+ MESSAGE="$MESSAGE\n ${{ env.windows_message }}"
737
827
fi
738
828
if [[ -n "${{ env.linux_message }}" ]]; then
739
- MESSAGE="$MESSAGE
740
- ${{ env.linux_message }}"
829
+ MESSAGE="$MESSAGE\n ${{ env.linux_message }}"
741
830
fi
742
831
if [[ -n "${{ env.ios_message }}" ]]; then
743
- MESSAGE="$MESSAGE
744
- ${{ env.ios_message }}"
832
+ MESSAGE="$MESSAGE\n ${{ env.ios_message }}"
745
833
fi
746
834
if [[ -n "${{ env.macos_message }}" ]]; then
747
- MESSAGE="$MESSAGE
748
- ${{ env.macos_message }}"
835
+ MESSAGE="$MESSAGE\n ${{ env.macos_message }}"
749
836
fi
750
837
751
838
if [[ "$MESSAGE" != "🎉 *Build Notification* 🎉" ]]; then
752
839
curl -sS -f -X POST \
753
- "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKKEN }}/sendMessage" \
754
- -F "chat_id=${{ secrets.TELEGRAM_CHANNEL_ID }}" \
755
- -F "message_thread_id=${{ secrets.TELEGRAM_THREAD_ID }}" \
840
+ "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKKEN}}/sendMessage" \
841
+ -F "chat_id=${{ secrets.TELEGRAM_CHANNEL_ID}}" \
842
+ -F "message_thread_id=${{ secrets.TELEGRAM_THREAD_ID}}" \
756
843
-F parse_mode="Markdown" \
757
844
-F disable_notification=true \
758
845
-F "text=$MESSAGE"
0 commit comments