-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (63 loc) · 3.16 KB
/
android_ci_cd.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
on:
push:
branches:
- main
- 'feat/*'
- 'dev/*'
pull_request:
branches:
- main
- 'feat/*'
- 'dev/*'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [ 17 ]
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java-version }}
distribution: 'temurin'
cache: gradle
- name: Cache Gradle dependencies
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-jdk-${{ matrix.java-version }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
gradle-${{ runner.os }}-jdk-${{ matrix.java-version }}-
- name: Grant execute permission for gradlew
run: chmod +x gradlew
# - name: Upload checksum results
# uses: actions/upload-artifact@v4
# with:
# name: checksum-results
# path: checksum.txt
- name: Build with Gradle
run: ./gradlew build
# - name: Upload APK
# if: success()
# uses: actions/upload-artifact@v4
# with:
# name: app
# path: app/build/outputs/**/*.apk
- name: Send Telegram Notification on Success
if: success()
run: |
curl -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \
-d chat_id="${{ secrets.TELEGRAM_CHAT_ID }}" \
-d text="🎉 <b>Build Successful!</b> 🎉%0A<b>Project</b>: 🚀 <a href='https://github.com/${{ github.repository }}'>${{ github.repository }}</a>%0A<b>Committer</b>: 👤 ${{ github.actor }}%0A<b>Message</b>: 💬 ${{ github.event.head_commit.message }}%0A<b>Branch</b>: 🌿 <code>${{ github.ref_name }}</code>%0A<b>Changes</b>: 🔗 <a href='https://github.com/${{ github.repository }}/commit/${{ github.sha }}'>View Changes</a>%0A<b>Workflow</b>: 📄 <a href='https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'>Details</a>%0A<b>Deployed At</b>: 🌐 <a href='https://api.quickmem.app'>QuickMem Server</a>" \
-d parse_mode="HTML"
- name: Send Telegram Notification on Failure
if: failure()
run: |
curl -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \
-d chat_id="${{ secrets.TELEGRAM_CHAT_ID }}" \
-d text="⚠️ <b>Build Failed!</b> ⚠️%0A<b>Project</b>: 🚀 <a href='https://github.com/${{ github.repository }}'>${{ github.repository }}</a>%0A<b>Committer</b>: 👤 ${{ github.actor }}%0A<b>Message</b>: 💬 ${{ github.event.head_commit.message }}%0A<b>Branch</b>: 🌿 <code>${{ github.ref_name }}</code>%0A<b>Changes</b>: 🔗 <a href='https://github.com/${{ github.repository }}/commit/${{ github.sha }}'>View Changes</a>%0A<b>Workflow</b>: 📄 <a href='https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'>Details</a>%0A<b>Error Details</b>: ❌ Check logs for more information." \
-d parse_mode="HTML"