Repository navigation
320 lines (265 loc) · 10.1 KB
/
Copy pathpatch.yml
File metadata and controls
320 lines (265 loc) · 10.1 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
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
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
name: Auto Build and Release ReVanced
on:
workflow_dispatch:
schedule:
- cron: '0 6 * * *' # Daily at 6 AM UTC
jobs:
download-tools:
name: Download ReVanced Tools
runs-on: ubuntu-latest
outputs:
cache-key: ${{ steps.cache-key.outputs.cache-key }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Download ReVanced Tools
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mkdir -p tools
curl -L "https://github.com/revanced/revanced-cli/releases/latest/download/revanced-cli-all.jar" -o tools/revanced-cli.jar
curl -L "https://github.com/revanced/revanced-patches/releases/latest/download/patches.jar" -o tools/patches.jar
curl -L "https://github.com/revanced/revanced-integrations/releases/latest/download/app-release-unsigned.apk" -o tools/integrations.apk
- name: Cache Tools
uses: actions/cache@v3
id: cache-tools
with:
path: tools/
key: revanced-tools-${{ hashFiles('patch-config.json', 'arch-config.json') }}
- name: Generate Cache Key
id: cache-key
run: echo "cache-key=${{ steps.cache-tools.outputs.cache-key || 'no-cache' }}" >> $GITHUB_OUTPUT
check-updates:
name: Check for Updates
needs: download-tools
runs-on: ubuntu-latest
outputs:
has_updates: ${{ steps.check.outputs.has_updates }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Always Build
id: check
run: echo "has_updates=true" >> $GITHUB_OUTPUT
patch-apps:
name: Read Configuration
needs: [check-updates, download-tools]
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.read-matrix.outputs.matrix }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Restore Cached Tools
uses: actions/cache@v3
with:
path: tools/
key: revanced-tools-${{ hashFiles('patch-config.json', 'arch-config.json') }}
- name: Read Patch Config
id: read-matrix
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const path = './patch-config.json';
const matrix = JSON.parse(fs.readFileSync(path, 'utf8')).patch_list;
core.setOutput("matrix", JSON.stringify(matrix));
build-apps:
name: Build Applications
needs: patch-apps
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.patch-apps.outputs.matrix) }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Restore Cached Tools
uses: actions/cache@v3
with:
path: tools/
key: revanced-tools-${{ hashFiles('patch-config.json', 'arch-config.json') }}
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install Dependencies
run: |
pip install -r requirements.txt
pip install requests beautifulsoup4
- name: Build APK
env:
APP_NAME: ${{ matrix.app_name }}
SOURCE: ${{ matrix.source }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Building ${{ matrix.app_name }} with ${{ matrix.source }}..."
sleep $((RANDOM % 30)).$((RANDOM % 100))
python -m src
- name: Upload APK Artifact
uses: actions/upload-artifact@v4
with:
name: apk-${{ matrix.app_name }}-${{ matrix.source }}
path: "*.apk"
create-single-release:
name: Create Single Release
needs: build-apps
runs-on: ubuntu-latest
if: always()
permissions:
contents: write
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Download All APK Artifacts
uses: actions/download-artifact@v4
with:
path: ./all-apks
if-no-files-found: warn
- name: Check if Any APKs Were Built
id: check-apks
run: |
# Count APK files
apk_count=$(find ./all-apks -name "*.apk" 2>/dev/null | wc -l)
echo "Found $apk_count APK(s)"
if [ $apk_count -eq 0 ]; then
echo "❌ No APKs were built successfully"
echo "skip_release=true" >> $GITHUB_OUTPUT
else
echo "✅ $apk_count APK(s) ready for release"
echo "skip_release=false" >> $GITHUB_OUTPUT
fi
- name: Delete Old Release
if: steps.check-apks.outputs.skip_release == 'false'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Check if "latest" release exists and delete it
echo "🔄 Checking for existing 'latest' release..."
if gh release view latest >/dev/null 2>&1; then
echo "🗑️ Deleting old 'latest' release..."
gh release delete latest --yes --cleanup-tag
echo "✅ Old release deleted"
else
echo "📭 No existing 'latest' release found"
fi
- name: Collect All APKs
if: steps.check-apks.outputs.skip_release == 'false'
run: |
mkdir -p ./release-apks
# Copy all APKs to release folder
echo "📦 Collecting APKs..."
find ./all-apks -name "*.apk" -exec cp {} ./release-apks/ \;
echo "📁 APKs ready for release:"
ls -la ./release-apks/
# Count again for display
final_count=$(ls -1 ./release-apks/*.apk 2>/dev/null | wc -l || echo "0")
echo "📊 Total APKs: $final_count"
- name: Generate Release Notes
if: steps.check-apks.outputs.skip_release == 'false'
run: |
echo "📝 Generating release notes..."
cat > release_notes.md << 'EOF'
# ReVanced APKs - Auto Built
## 📱 Available Apps
EOF
# Group apps by name (remove architecture suffix for grouping)
declare -A app_info
for apk in ./release-apks/*.apk; do
if [ -f "$apk" ]; then
filename=$(basename "$apk")
# Extract app name (remove architecture and version info)
app_name=$(echo "$filename" | sed -E 's/-(arm64-v8a|armeabi-v7a|universal|patch|revanced|cli)-.*//' | sed 's/-/ /g')
# Extract architecture
if [[ "$filename" == *"arm64-v8a"* ]]; then
arch="arm64-v8a"
elif [[ "$filename" == *"armeabi-v7a"* ]]; then
arch="armeabi-v7a"
else
arch="universal"
fi
# Extract version
version=$(echo "$filename" | grep -oE 'v[0-9]+\.[0-9]+(\.[0-9]+)*' | head -1 || echo "unknown")
# Store in associative array
key="$app_name"
if [ -z "${app_info[$key]}" ]; then
app_info[$key]=""
fi
app_info[$key]="${app_info[$key]}<br>• $arch: $version"
fi
done
# Create a simple markdown list
for app in "${!app_info[@]}"; do
echo "### $app" >> release_notes.md
echo "${app_info[$app]:4}" | sed 's/<br>/\n/g' >> release_notes.md
echo "" >> release_notes.md
done
cat >> release_notes.md << 'EOF'
---
## ⚙️ Build Information
- **Auto-built daily at 6 AM UTC**
- **Multiple architecture support** (arm64-v8a, armeabi-v7a, universal)
- **Latest ReVanced patches**
- **Updated automatically**
## 📊 Architecture Guide
- **arm64-v8a**: Modern ARM devices (2014+)
- **armeabi-v7a**: Older ARM devices
- **universal**: All ARM devices (larger file)
## ⚠️ Disclaimer
These APKs are built automatically. Use at your own risk.
## 🔄 Update Schedule
- Automatic updates daily at 6 AM UTC
- Manual updates available via workflow dispatch
- Always replaces the previous release
EOF
- name: Create New Release
if: steps.check-apks.outputs.skip_release == 'false'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "🚀 Creating new release with APKs..."
# Count APKs
apk_count=$(ls -1 ./release-apks/*.apk 2>/dev/null | wc -l || echo "0")
if [ $apk_count -eq 0 ]; then
echo "❌ No APKs found to release"
exit 1
fi
echo "📦 Releasing $apk_count APK(s)..."
# Create the release
gh release create "latest" \
--title "ReVanced APKs - $(date +'%Y-%m-%d %H:%M')" \
--notes-file release_notes.md \
./release-apks/*.apk \
--latest
echo "✅ Release created successfully!"
- name: Display Release URL
if: steps.check-apks.outputs.skip_release == 'false'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
release_url=$(gh release view latest --json url --jq .url)
echo "🔗 Release URL: $release_url"
echo ""
echo "📦 Direct Download Links:"
for apk in ./release-apks/*.apk; do
filename=$(basename "$apk")
echo "- $filename: $release_url/download/$filename"
done
cleanup:
name: Cleanup Workflow Runs
needs: build-apps
runs-on: ubuntu-latest
if: always()
permissions:
actions: write
steps:
- name: Delete Old Workflow Runs
uses: Mattraks/delete-workflow-runs@v2
with:
retain_days: 3
keep_minimum_runs: 5