-
Notifications
You must be signed in to change notification settings - Fork 8
187 lines (153 loc) · 7.57 KB
/
patch-release.yaml
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
name: Telegram APK Auto-Patcher
on:
schedule:
- cron: '0 */12 * * *'
workflow_dispatch:
jobs:
auto_patch:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11'
- name: Install dependencies
run: sudo apt-get install -y wget zipalign aapt
- name: Download Telegram APK
run: |
tg_apk_url="https://telegram.org/dl/android/apk"
wget -q --show-progress $tg_apk_url -O Telegram.apk
- name: Get latest Telegram version
id: get_version
run: |
aapt dump badging Telegram.apk | grep -oP "versionName='[^']*" | cut -d "'" -f2 > tg_version.txt
echo "Latest version: $(cat tg_version.txt)"
- name: Check if new version is available
id: version_check
run: |
if [ -f backup_tg_version.txt ]; then
old_version=$(cat backup_tg_version.txt)
else
old_version=""
fi
new_version=$(cat tg_version.txt)
if [ "$new_version" != "$old_version" ]; then
echo "new_version_available=true" >> $GITHUB_ENV
else
echo "new_version_available=false" >> $GITHUB_ENV
fi
- name: Set Telegram Version
if: env.new_version_available == 'true'
id: set_version
run: echo "version=$(cat tg_version.txt)" >> $GITHUB_ENV
- name: Download apktool
if: env.new_version_available == 'true'
run: |
if [ ! -f apktool.jar ]; then
echo "apktool.jar not found, downloading..."
wget -q --show-progress https://bitbucket.org/iBotPeaches/apktool/downloads/apktool_2.10.0.jar -O apktool.jar
fi
- name: Decompile APK
if: env.new_version_available == 'true'
run: |
java -jar apktool.jar d Telegram.apk -f
rm -rf Telegram/lib/x86*
- name: Apply Normal Patches
if: env.new_version_available == 'true'
run: |
echo "Applying Normal Patches..."
python3 tgpatcher.py --normal --dir Telegram/
echo "Patches applied, building apk..."
java -jar apktool.jar b Telegram/ -o Telegram_Patched.apk
echo "NOTE: apk may not be signed, you may need to sign it manually."
- name: Apply Anti+Normal Patches
if: env.new_version_available == 'true'
run: |
java -jar apktool.jar d Telegram.apk -f
rm -rf Telegram/lib/x86*
echo "Applying Anti+Normal Patches..."
python3 tgpatcher.py --anti --dir Telegram/
echo "Patches applied, building apk..."
java -jar apktool.jar b Telegram/ -o Telegram_Anti_Patched.apk
echo "NOTE: apk may not be signed, you may need to sign it manually."
- name: ZipAlign APks
if: env.new_version_available == 'true'
run: |
zipalign -p -f 4 Telegram_Patched.apk Telegram_Patched_aligned.apk
rm Telegram_Patched.apk
zipalign -p -f 4 Telegram_Anti_Patched.apk Telegram_Anti_Patched_aligned.apk
rm Telegram_Anti_Patched.apk
- name: Sign APks
if: env.new_version_available == 'true'
run: |
java -jar keystore/apksigner.jar sign --in Telegram_Patched_aligned.apk --out Telegram_Patched_${{ env.version }}.apk --ks keystore/debug.keystore --ks-key-alias androiddebugkey --ks-pass pass:android --key-pass pass:android --v1-signing-enabled true --v2-signing-enabled true --v3-signing-enabled true --v4-signing-enabled false
rm Telegram_Patched_aligned.apk
java -jar keystore/apksigner.jar sign --in Telegram_Anti_Patched_aligned.apk --out Telegram_Anti_Patched_${{ env.version }}.apk --ks keystore/debug.keystore --ks-key-alias androiddebugkey --ks-pass pass:android --key-pass pass:android --v1-signing-enabled true --v2-signing-enabled true --v3-signing-enabled true --v4-signing-enabled false
rm Telegram_Anti_Patched_aligned.apk
- name: Install upload requirements
if: env.new_version_available == 'true'
run: pip install pyrofork tgcrypto
- name: Send Normal APK to Telegram
if: env.new_version_available == 'true'
run: |
export BOT_TOKEN=${{ secrets.BOT_TOKEN }}
export API_ID=${{ secrets.API_ID }}
export API_HASH=${{ secrets.API_HASH }}
python3 tgupload.py Telegram_Patched_${{ env.version }}.apk --chat-id ${{ secrets.CHAT_ID }} --caption "$(cat <<EOF
**Telegram [ Premium ] [ Local+ ] [ Direct ] [ Normal ]**
**Version :** ${{ env.version }}
**Architecture :** Arm + Arm64
**Requirements:** Android 6.0 and up
**Overview:**
Telegram is a messaging app with a focus on speed and security.
**❏Changelogs:**
● See [Full Changelogs](https://telegra.ph/Telegram-premium-08-16-5)
- **Released by [ Abhi ]**
👉 **How to Save/Forward from copyrighted channels:** [Watch Here](https://youtu.be/TIlxcnzC-mM)
**NOTE:**
- If you're **facing issue during login** like internal error, not getting OTP then **download Telegram X** from play store -> Login in it -> come back and login to mod
- Adding stories functionality gets unlocked with premium mod, but
- If you still didn't get the story feature, [read more about it here](http://tginfo.me/stories-by-countries)
EOF
)"
- name: Send Anti APK to Telegram
if: env.new_version_available == 'true'
run: |
export BOT_TOKEN=${{ secrets.BOT_TOKEN }}
export API_ID=${{ secrets.API_ID }}
export API_HASH=${{ secrets.API_HASH }}
python3 tgupload.py Telegram_Anti_Patched_${{ env.version }}.apk --chat-id ${{ secrets.CHAT_ID }} --caption "$(cat <<EOF
**Telegram [ Premium ] [ Local+ ] [ Direct ] [ Anti ]**
**Version :** ${{ env.version }}
**Architecture :** Arm + Arm64
**Requirements:** Android 6.0 and up
**Overview:**
Telegram is a messaging app with a focus on speed and security.
**❏Changelogs:**
● See [Full Changelogs](https://telegra.ph/Telegram-premium-08-16-5)
- **Released by [ Abhi ]**
👉 **How to Save/Forward from copyrighted channels:** [Watch Here](https://youtu.be/TIlxcnzC-mM)
**NOTE:**
- If you're **facing issue during login** like internal error, not getting OTP then **download Telegram X** from play store -> Login in it -> come back and login to mod
- Adding stories functionality gets unlocked with premium mod, but
- If you still didn't get the story feature, [read more about it here](http://tginfo.me/stories-by-countries)
EOF
)"
- name: Update version files and commit changes
if: env.new_version_available == 'true'
run: |
cp tg_version.txt backup_tg_version.txt
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add backup_tg_version.txt
git commit -m "Update version files to $(cat tg_version.txt)"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}