-
Notifications
You must be signed in to change notification settings - Fork 10
130 lines (115 loc) · 4.08 KB
/
Copy pathmain.yml
File metadata and controls
130 lines (115 loc) · 4.08 KB
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
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
environment: Release
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: notify telegram
if: github.event_name != 'pull_request'
uses: EverythingSuckz/github-telegram-notify@main
continue-on-error: true
with:
bot_token: ${{ secrets.BOT_TOKEN }}
chat_id: ${{ secrets.CHAT_ID }}
topic_id: 4
build_preview_apk:
name: Build App Preview APKs
runs-on: ubuntu-latest
env:
TG_BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
TG_CHAT_ID: ${{ secrets.CHAT_ID }}
LOG_CHAT_ID: ${{ secrets.LOG_CHAT_ID }}
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
ALIAS_PASSWORD: ${{ secrets.ALIAS_PASSWORD }}
environment: MainEnv
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
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 Preview build for both ABIs
if: github.event_name != 'pull_request'
run: |
./gradlew assemblePreview \
-DLOG_CHAT_ID="${{ secrets.LOG_CHAT_ID }}" \
-DTG_BOT_TOKEN="${{ secrets.BOT_TOKEN }}" \
-DTG_CHAT_ID="${{ secrets.CHAT_ID }}" \
-DKEYSTORE_BASE64="${{ secrets.KEYSTORE_BASE64 }}" \
-DKEYSTORE_PASSWORD="${{ secrets.KEYSTORE_PASSWORD }}" \
-DKEY_ALIAS="${{ secrets.KEY_ALIAS }}" \
-DALIAS_PASSWORD="${{ secrets.ALIAS_PASSWORD }}"
- name: Rename APKs with commit hash
run: |
HASH=${GITHUB_SHA::8}
mv app/build/outputs/apk/preview/app-arm64-v8a-preview.apk app/build/outputs/apk/preview/preview-arm64-v8a-${HASH}.apk
mv app/build/outputs/apk/preview/app-armeabi-v7a-preview.apk app/build/outputs/apk/preview/preview-armeabi-v7a-${HASH}.apk
- name: Upload preview arm64 apk
uses: actions/upload-artifact@v4
with:
name: preview-arm64
path: app/build/outputs/apk/preview/preview-arm64-v8a-*.apk
- name: Upload preview armeabi apk
uses: actions/upload-artifact@v4
with:
name: preview-armeabi
path: app/build/outputs/apk/preview/preview-armeabi-v7a-*.apk
send_preview_apks:
name: Send Preview APKs
runs-on: ubuntu-latest
needs: build_preview_apk
environment: Release
if: github.ref == 'refs/heads/preview' && github.event_name != 'pull_request'
steps:
- name: Download arm64 apk
uses: actions/download-artifact@v4
with:
name: preview-arm64
path: .
- name: Download armeabi apk
uses: actions/download-artifact@v4
with:
name: preview-armeabi
path: .
- name: Send arm64 APK to Telegram
if: success()
continue-on-error: true
run: |
HASH=${GITHUB_SHA::8}
curl -X POST "https://api.telegram.org/bot${{ secrets.BOT_TOKEN }}/sendDocument" \
-F chat_id="${{ secrets.CHAT_ID }}" \
-F message_thread_id="4" \
-F document=@"preview-arm64-v8a-${HASH}.apk" \
-F caption="arm64-v8a Build"
- name: Send armeabi APK to Telegram
if: success()
continue-on-error: true
run: |
HASH=${GITHUB_SHA::8}
curl -X POST "https://api.telegram.org/bot${{ secrets.BOT_TOKEN }}/sendDocument" \
-F chat_id="${{ secrets.CHAT_ID }}" \
-F message_thread_id="4" \
-F document=@"preview-armeabi-v7a-${HASH}.apk" \
-F caption="armeabi-v7a Build"