-
Notifications
You must be signed in to change notification settings - Fork 2
201 lines (181 loc) · 6.55 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
name: Android CI
on:
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Storing key.properties
run: |
echo "${{ secrets.KEY_PROPERTIES }}" | base64 --decode > ./key.properties
ls ./
ls -l key.properties
- name: Storing keystore
run: |
echo "${{ secrets.KEYSTORE }}" | base64 --decode > ./app/key.keystore
ls ./app
ls -l ./app/key.keystore
- name: Storing keystore
run: |
echo "${{ secrets.KEYSTORE }}" | base64 --decode > ./key.keystore
ls -l ./key.keystore
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: |
./gradlew :app:assembleRelease
echo "APK_FILE=$(find app/build/outputs/apk -name '*arm64*.apk')" >> $GITHUB_ENV
echo "APK_FILE_ARMV7=$(find app/build/outputs/apk -name '*v7a*.apk')" >> $GITHUB_ENV
echo "APK_FILE_X86=$(find app/build/outputs/apk -name '*x86*.apk')" >> $GITHUB_ENV
echo "APK_FILE_X64=$(find app/build/outputs/apk -name '*x64*.apk')" >> $GITHUB_ENV
- uses: actions/upload-artifact@v2
name: Upload apk (arm64-v8a)
with:
name: LiveInPeace-arm64-v8a
path: ${{ env.APK_FILE }}
- uses: actions/upload-artifact@v2
name: Upload apk (armeabi-v7a)
with:
name: LiveInPeace-armeabi-v7a
path: ${{ env.APK_FILE_ARMV7 }}
- uses: actions/upload-artifact@v2
name: Upload apk (x86_64)
with:
name: LiveInPeace-x86_64
path: ${{ env.APK_FILE_X64 }}
- uses: actions/upload-artifact@v2
name: Upload apk (x86)
with:
name: LiveInPeace-x86
path: ${{ env.APK_FILE_X86 }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
tag_name: v${{ github.run_number }}
prerelease: true
release_name: Release v${{ github.run_number }}
body: |
## Changes
${{ github.event.pull_request.body }}
${{ steps.show_pr_commits.outputs.commits }}
- uses: actions/upload-release-asset@v1
name: Upload apk (arm64-v8a)
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: LiveInPeace-arm64-v8a.apk
asset_path: ${{ env.APK_FILE }}
asset_content_type: application/zip
- uses: actions/upload-release-asset@v1
name: Upload apk (armeabi-v7a)
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: LiveInPeace-armeabi-v7a.apk
asset_path: ${{ env.APK_FILE_ARMV7 }}
asset_content_type: application/zip
- uses: actions/upload-release-asset@v1
name: Upload apk (x86_64)
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: LiveInPeace-x86_64.apk
asset_path: ${{ env.APK_FILE_X64 }}
asset_content_type: application/zip
- uses: actions/upload-release-asset@v1
name: Upload apk (x86)
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: LiveInPeace-x86.apk
asset_path: ${{ env.APK_FILE_X86 }}
asset_content_type: application/zip
upload:
name: Upload Release
runs-on: ubuntu-latest
needs:
- build
- telegram-bot-api
steps:
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Download Telegram Bot API Binary
uses: actions/download-artifact@master
with:
name: telegram-bot-api-binary
path: .
- name: find apk
run: |
mkdir apks
find artifacts -name "*.apk" -exec cp {} apks \;
echo "APK_FILE_UPLOAD=$(find apks -name '*arm64*.apk')" >> $GITHUB_ENV
ls ./apks
- name: Get Apk Info
id: apk
uses: JantHsueh/get-apk-info-action@master
with:
apkPath: ${{ env.APK_FILE_UPLOAD }}
- name: Release
run: |
chmod +x telegram-bot-api-binary
./telegram-bot-api-binary --api-id=21724 --api-hash=3e0cb5efcd52300aec5994fdfc5bdc16 --local 2>&1 > /dev/null &
curl https://raw.githubusercontent.com/Steve-Mr/LiveInPeace/dev/.github/scripts/upload.py -o uploadCI.py
python uploadCI.py > upload.txt
cat upload.txt
env:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
VERSION_CODE: ${{steps.apk.outputs.versionCode}}
VERSION_NAME: ${{steps.apk.outputs.versionNum}}
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
telegram-bot-api:
name: Telegram Bot API
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Clone Telegram Bot API
run: |
git clone --recursive https://github.com/tdlib/telegram-bot-api.git
git status telegram-bot-api >> telegram-bot-api-status
- name: Cache Bot API Binary
id: cache-bot-api
uses: actions/cache@v2
with:
path: telegram-bot-api-binary
key: CI-telegram-bot-api-${{ hashFiles('telegram-bot-api-status') }}
- name: Compile Telegram Bot API
if: steps.cache-bot-api.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install make git zlib1g-dev libssl-dev gperf cmake g++
cd telegram-bot-api
rm -rf build
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=.. ..
cmake --build . --target install -j$(nproc)
cd ../..
ls -l telegram-bot-api/bin/telegram-bot-api*
cp telegram-bot-api/bin/telegram-bot-api telegram-bot-api-binary
- name: Upload Binary
uses: actions/upload-artifact@master
with:
name: telegram-bot-api-binary
path: telegram-bot-api-binary