forked from Sketchware-Pro/Sketchware-Pro
-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (113 loc) · 3.84 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
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
name: Android CI
on:
push:
paths:
- '.github/workflows/android.yml'
- 'app/**'
- 'gradle/**'
- 'build.gradle'
- 'gradle.properties'
- 'gradlew'
- 'gradlew.bat'
- 'public-stable-ids.txt'
- 'settings.gradle'
branches-ignore:
- 'wip/**'
workflow_dispatch:
jobs:
notifyTelegram:
name: Notify Telegram
runs-on: ${{ vars.IS_USING_HOSTED_RUNNERS == 'true' && 'self-hosted' || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v4
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Dependencies
run: |
pip install requests
- name: Send a message to Telegram
env:
BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
TOPIC_ID: ${{ secrets.TELEGRAM_TOPIC_ID }}
run: |
python ./.github/workflows/notify_telegram.py
continue-on-error: true
build:
name: Build APKs
runs-on: ${{ vars.IS_USING_HOSTED_RUNNERS == 'true' && 'self-hosted' || 'ubuntu-latest' }}
strategy:
matrix:
apiLevel: [21, 26]
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Set environmental variables
shell: bash
env:
JSON_CONTENT: ${{ secrets.GOOGLE_SERVICES_JSON }}
if: ${{ env.JSON_CONTENT != '' }}
run: |
printf 'GOOGLE_SERVICES_JSON<<EOF\n%s\nEOF\n' "$JSON_CONTENT" >> $GITHUB_ENV
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Build Release APK
env:
SKETCHUB_API_KEY: ${{ secrets.SKETCHUB_API_KEY }}
run: gradle assembleMinApi${{ matrix.apiLevel }}Release
- name: Upload Release APK
uses: actions/upload-artifact@v4
with:
name: apk-minApi${{ matrix.apiLevel }}-release
path: app/build/outputs/apk/minApi${{ matrix.apiLevel }}/release
aggregateAndSend:
name: Send APKs to Telegram
runs-on: ${{ vars.IS_USING_HOSTED_RUNNERS == 'true' && 'self-hosted' || 'ubuntu-latest' }}
needs: build
steps:
- uses: actions/checkout@v4
- name: Download Artifacts for API 21
uses: actions/download-artifact@v4
with:
name: apk-minApi21-release
path: ./downloaded-artifact/minApi21
- name: Download Artifacts for API 26
uses: actions/download-artifact@v4
with:
name: apk-minApi26-release
path: ./downloaded-artifact/minApi26
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Dependencies
run: |
pip install telethon
- name: Get Git Commit Info
run: |
echo "COMMIT_AUTHOR=$(git log -1 --pretty=format:'%an')" >> $GITHUB_ENV
echo "COMMIT_MESSAGE=$(git log -1 --pretty=format:'%s')" >> $GITHUB_ENV
- name: Restore Telegram session cache
uses: actions/cache@v4
id: telegram_session_cache
with:
path: bot_session.session
key: telegram-session-${{ runner.os }}-bot_session
- name: Send APKs to Telegram
env:
API_ID: ${{ secrets.TELEGRAM_API_ID }}
API_HASH: ${{ secrets.TELEGRAM_API_HASH }}
BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
TOPIC_ID: ${{ secrets.TELEGRAM_TOPIC_ID }}
APK_MIN_API21: ./downloaded-artifact/minApi21/app-minApi21-release.apk
APK_MIN_API26: ./downloaded-artifact/minApi26/app-minApi26-release.apk
run: |
python ./.github/workflows/deploy_artifacts.py
continue-on-error: true