forked from ABCPascal/SnapEnhanceModGen
-
Notifications
You must be signed in to change notification settings - Fork 0
251 lines (211 loc) · 10.3 KB
/
patch-latest-release.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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
name: Patch and Release APK
on:
schedule:
- cron: '55 23 * * 4'
workflow_dispatch:
inputs:
no-release:
description: "Don't release"
type: boolean
default: false
draft:
description: "Draft release"
type: boolean
default: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '17'
- name: Set JAVA_HOME
run: echo "JAVA_HOME=$(echo ${{ steps.setup-java.outputs.java-home }})" >> $GITHUB_ENV
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0 # required for github-action-get-previous-tag
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y jq curl
shell: bash
- name: Install unzip
run: sudo apt-get install unzip -y
- name: Install pup
run: |
wget https://github.com/ericchiang/pup/releases/download/v0.4.0/pup_v0.4.0_linux_amd64.zip -O pup.zip
unzip pup.zip
chmod +x pup
sudo mv pup /usr/local/bin/
working-directory: .
- name: Grant execute permissions to script
run: chmod +x script.sh
working-directory: .
- name: Run APK Download Script
run: |
./script.sh
- name: Determine Snapchat Filename
run: |
snapchatapkname=$(ls snapchatapk/*chat*)
echo "snapchat_apk_filename=$snapchatapkname" >> $GITHUB_ENV
- name: REGEX Snapchat Version
id: REGEX_snapchat_version
uses: 'frabert/[email protected]'
with:
pattern: 'snapchatapk/snap.*?(\d+)-(\d+)-(\d+)-(\d+)\.apk'
string: ${{ env.snapchat_apk_filename }}
replace-with: 'v$1.$2.$3.$4'
- name: REGEX Snapchat Name
id: REGEX_snapchat_name
uses: 'frabert/[email protected]'
with:
pattern: 'snapchatapk/(snap.*?)\.apk'
string: ${{ env.snapchat_apk_filename }}
replace-with: '$1'
- name: Fetch latest SnapEnhance info and Name the APK files
id: fetch-release
run: |
repo_owner="rhunk"
repo_name="SnapEnhance"
api_url="https://api.github.com/repos/${repo_owner}/${repo_name}/releases/latest"
release_info=$(curl "$api_url")
release_id=$(echo $release_info | jq -r '.id')
release_tag_name=$(echo $release_info | jq -r '.tag_name')
# Find the asset URL for APK files
for asset in $(echo $release_info | jq -c '.assets[]'); do
asset_name=$(echo $asset | jq -r '.name')
if [[ $asset_name == *"all"* && $asset_name == *".apk" ]]; then
universal_asset_url=$(echo $asset | jq -r '.browser_download_url')
break
fi
done
for asset in $(echo $release_info | jq -c '.assets[]'); do
asset_name=$(echo $asset | jq -r '.name')
if [[ $asset_name == *"armv8"* && $asset_name == *".apk" ]]; then
arm64_v8a_asset_url=$(echo $asset | jq -r '.browser_download_url')
break
fi
done
for asset in $(echo $release_info | jq -c '.assets[]'); do
asset_name=$(echo $asset | jq -r '.name')
if [[ $asset_name == *"armv7"* && $asset_name == *".apk" ]]; then
armeabi_v7a_asset_url=$(echo $asset | jq -r '.browser_download_url')
break
fi
done
echo "snapenhance_release_id=$release_id" >> $GITHUB_ENV
echo "snapenhance_release_tag_name=$release_tag_name" >> $GITHUB_ENV
echo "snapenhance_universal_asset_url=$universal_asset_url" >> $GITHUB_ENV
echo "snapenhance_arm64-v8a_asset_url=$arm64_v8a_asset_url" >> $GITHUB_ENV
echo "snapenhance_armeabi-v7a_asset_url=$armeabi_v7a_asset_url" >> $GITHUB_ENV
echo "snapenhance_universal_apk_filename=snapenhance-universal-$release_tag_name.apk" >> $GITHUB_ENV
echo "snapenhance_arm64-v8a_apk_filename=snapenhance-arm64-v8a-$release_tag_name.apk" >> $GITHUB_ENV
echo "snapenhance_armeabi-v7a_apk_filename=snapenhance-armeabi-v7a-$release_tag_name.apk" >> $GITHUB_ENV
echo "patched_universal_apk_filename=patched-snapchat-universal-${{ steps.REGEX_snapchat_version.outputs.replaced }}.apk" >> $GITHUB_ENV
echo "patched_arm64-v8a_apk_filename=patched-snapchat-arm64-v8a-${{ steps.REGEX_snapchat_version.outputs.replaced }}.apk" >> $GITHUB_ENV
echo "patched_armeabi-v7a_apk_filename=patched-snapchat-armeabi-v7a-${{ steps.REGEX_snapchat_version.outputs.replaced }}.apk" >> $GITHUB_ENV
shell: bash
- name: Download Universal SnapEnhance APK
run: |
wget "${{ env.snapenhance_universal_asset_url }}" -O "$GITHUB_WORKSPACE/${{ env.snapenhance_universal_apk_filename }}"
shell: bash
- name: Download arm64-v8a SnapEnhance APK
run: |
wget "${{ env.snapenhance_arm64-v8a_asset_url }}" -O "$GITHUB_WORKSPACE/${{ env.snapenhance_arm64-v8a_apk_filename }}"
shell: bash
- name: Download armeabi-v7a SnapEnhance APK
run: |
wget "${{ env.snapenhance_armeabi-v7a_asset_url }}" -O "$GITHUB_WORKSPACE/${{ env.snapenhance_armeabi-v7a_apk_filename }}"
shell: bash
- name: Patch Snapchat with Universal SnapEnhance APK
run: |
java -jar lspatch.jar -m ${{ env.snapenhance_universal_apk_filename }} -f -l 2 -v ${{ env.snapchat_apk_filename }}
- name: Rename universal patched APK
run: |
mv ./${{ steps.REGEX_snapchat_name.outputs.replaced }}-402-lspatched.apk ./${{ env.patched_universal_apk_filename }}
- name: Patch Snapchat with arm64-v8a SnapEnhance APK
run: |
java -jar lspatch.jar -m ${{ env.snapenhance_arm64-v8a_apk_filename }} -f -l 2 -v ${{ env.snapchat_apk_filename }}
- name: Rename arm64-v8a patched APK
run: |
mv ./${{ steps.REGEX_snapchat_name.outputs.replaced }}-402-lspatched.apk ./${{ env.patched_arm64-v8a_apk_filename }}
- name: Patch Snapchat with armeabi-v7a SnapEnhance APK
run: |
java -jar lspatch.jar -m ${{ env.snapenhance_armeabi-v7a_apk_filename }} -f -l 2 -v ${{ env.snapchat_apk_filename }}
- name: Rename armeabi-v7a patched APK
run: |
mv ./${{ steps.REGEX_snapchat_name.outputs.replaced }}-402-lspatched.apk ./${{ env.patched_armeabi-v7a_apk_filename }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.REGEX_snapchat_name.outputs.replaced }}.apk
path: ./${{ env.snapchat_apk_filename }}
- name: Obtain latest upstream release tag
# don't omit the step ID, it's used later to access the api response
id: previoustag
uses: fjogeleit/http-request-action@v1
with:
url: "https://api.github.com/repos/NicholasFlamy/snapenhance-no-root-patch/releases/latest"
method: 'GET'
- name: REGEX last version for 1st-3rd part
id: REGEX_1st-3rd_part
uses: 'frabert/[email protected]'
with:
pattern: 'v(\d+)\.(\d+)\.(\d+)\.(\d+)'
string: ${{ fromJson(steps.previoustag.outputs.response).tag_name }}
replace-with: 'v$1.$2.$3'
- name: REGEX last version for 4th part
id: REGEX_4th_part
uses: 'frabert/[email protected]'
with:
pattern: 'v(\d+)\.(\d+)\.(\d+)\.(\d+)'
string: ${{ fromJson(steps.previoustag.outputs.response).tag_name }}
replace-with: '$4'
- name: Up the version if same SnapEnhance version
id: semver
if: ${{ env.snapenhance_release_tag_name == steps.REGEX_1st-3rd_part.outputs.replaced }}
uses: 'WyriHaximus/github-action-next-release-version@v1'
with:
version: ${{ steps.REGEX_4th_part.outputs.replaced }}
- name: Define Release Version if same SnapEnhance version
if: ${{ env.snapenhance_release_tag_name == steps.REGEX_1st-3rd_part.outputs.replaced }}
run: |
echo "RELEASE_VERSION=${{ steps.REGEX_1st-3rd_part.outputs.replaced }}.${{ steps.semver.outputs.version }}" >> $GITHUB_ENV
- name: Define Release Version if different SnapEnhance version
if: ${{ env.snapenhance_release_tag_name != steps.REGEX_1st-3rd_part.outputs.replaced }}
run: |
echo "RELEASE_VERSION=${{ env.snapenhance_release_tag_name }}.0" >> $GITHUB_ENV
- name: Create and Publish Release
id: create-publish-release
if: ${{ inputs.no-release != true }}
uses: softprops/[email protected]
with:
tag_name: ${{ env.RELEASE_VERSION }}
name: SnapEnhance Patched APK ${{ env.RELEASE_VERSION }}
fail_on_unmatched_files: true
files: |
${{ env.patched_arm64-v8a_apk_filename }}
${{ env.patched_armeabi-v7a_apk_filename }}
${{ env.patched_universal_apk_filename }}
${{ env.snapenhance_arm64-v8a_apk_filename }}
${{ env.snapenhance_armeabi-v7a_apk_filename }}
${{ env.snapenhance_universal_apk_filename }}
body: |
<h2>Version Information:</h2>
Snapchat Version: `${{ steps.REGEX_snapchat_version.outputs.replaced }}`
SnapEnhance Version: `${{ env.snapenhance_release_tag_name }}`
<h3>Instructions:</h3>
If you want to use SnapEnhance Snapchat on Android without root, then you need to download amd install the patched Snapchat APK and the SnapEnhance APK for your architecture, if you don't know your architecture, [learn how to find your architecture](https://github.com/NicholasFlamy/snapenhance-no-root-patch/blob/master/LEARNFINDARCH.md) or download `${{ env.patched_universal_apk_filename }}` and `${{ env.snapenhance_universal_apk_filename }}`.
Automate your updates with [Obtainium](https://github.com/NicholasFlamy/snapenhance-no-root-patch#obtainium-instructions).
draft: ${{ contains(inputs.draft, 'true') }}