This repository has been archived by the owner on Dec 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
99 lines (82 loc) · 2.57 KB
/
android.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
name: Android CI
on:
push:
branches: [ "**" ]
paths-ignore:
- '**/*.md'
pull_request:
branches: [ "**" ]
paths-ignore:
- '**/*.md'
workflow_dispatch:
jobs:
init:
name: Init
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: notify telegram
uses: EverythingSuckz/github-telegram-notify@main
continue-on-error: true
with:
bot_token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
chat_id: -1002355760766
topic_id: 11
build_release_apk:
name: Build App Release APK
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'oracle'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Validate Gradle wrapper
uses: gradle/actions/wrapper-validation@v4
- name: Build with Gradle
id: gradle_build_release
run: ./gradlew assembleRelease
- name: Upload release apk
uses: actions/upload-artifact@v4
with:
name: app-release
path: app/build/outputs/apk/release/app-release.apk
send_release_apk:
name: Send Release APK
runs-on: ubuntu-latest
needs: build_release_apk
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Download release apk
uses: actions/download-artifact@v4
with:
name: app-release
- name: List repo contents
run: ls
- name: Get the last commit message
id: get_commit_msg
run: |
commit_message=$(git log -1 --pretty=format:'%s')
echo "message=$commit_message" >> $GITHUB_OUTPUT
- name: Rename file
run: |
mv app-release.apk sparkles-app-release.apk
ls
- name: Send APK to Release Channel Telegram with Topic ID
if: success()
continue-on-error: true
run: |
curl -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendDocument" \
-F chat_id="${{ secrets.TELEGRAM_CHAT_ID }}" \
-F message_thread_id="11" \
-F document=@"sparkles-app-release.apk" \
-F caption="${{ github.event.head_commit.message }} by ${{ github.actor }}"