forked from j-hc/revanced-magisk-module
-
-
Notifications
You must be signed in to change notification settings - Fork 87
257 lines (232 loc) · 8.67 KB
/
matrix-build.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
252
253
254
255
256
257
name: Matrix Build Modules
on:
workflow_call:
secrets:
TELEGRAM_TOKEN:
description: "Telegram Bot Token"
required: true
TELEGRAM_TO:
description: "Telegram Chat ID"
required: true
inputs:
from_ci:
type: boolean
required: false
default: true
workflow_dispatch:
permissions: write-all
jobs:
generate-release:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.versionr }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Prepare version
id: version
run: echo "versionr=$(date +v%Y.%m.%d-%H%M)" >> $GITHUB_OUTPUT
- name: Generate release
run: |
version=${{ steps.version.outputs.versionr }}
echo -e "# ReVanced Patches\n" > release_notes.md
dateRevanced=$(date -u -d $(gh release view --json publishedAt -q .publishedAt --repo revanced/revanced-patches))
echo -e "\n Published on $dateRevanced\n" >> release_notes.md
gh release view --json body -q .body --repo revanced/revanced-patches >> release_notes.md
echo -e "\n---\n" >> release_notes.md
echo -e "# RVX Patches\n" >> release_notes.md
dateRex=$(date -u -d $(gh release view --json publishedAt -q .publishedAt --repo inotia00/revanced-patches))
echo -e "\n Published on $dateRex\n" >> release_notes.md
gh release view --json body -q .body --repo inotia00/revanced-patches >> release_notes.md
echo -e "\n---\n" >> release_notes.md
echo -e "# Anddea Patches\n" >> release_notes.md
dateAnddea=$(date -u -d $(gh release view --json publishedAt -q .publishedAt --repo anddea/revanced-patches))
echo -e "\n Published on $dateAnddea\n" >> release_notes.md
gh release view --json body -q .body --repo anddea/revanced-patches >> release_notes.md
echo -e "\n---\n" >> release_notes.md
echo -e "\nUse [MicroG](https://github.com/ReVanced/GmsCore/releases/latest) for YouTube and Music" >> release_notes.md
sed -i "1s/^/Release $version\n\n/" release_notes.md
gh release create "$version" --draft -t "$version" -F release_notes.md
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run:
runs-on: ubuntu-latest
needs: generate-release
strategy:
fail-fast: false
matrix:
include:
- id: "YouTube-Extended"
- id: "Music-Extended"
- id: "Reddit-Extended"
- id: "YouTube-anddea"
- id: "Music-anddea"
- id: "YouTube"
- id: "Music"
- id: "Twitter"
- id: "Twitch"
- id: "TikTok"
- id: "Reddit"
- id: "Messenger"
- id: "Facebook"
- id: 'Spotify'
- id: "Spotify-Lite"
# - id: "Citra"
# - id: "Backdrops"
# - id: "WarnWetter"
# - id: "Windyapp"
- id: "MyExpenses"
- id: "NyxMusicPlayer"
- id: "IconPackStudio"
- id: "TickTick"
- id: "Tasker"
- id: "Photomath"
# - id: "Instagram-armeabi-v7a"
- id: "Instagram"
- id: "InShorts"
# - id: "SyncForReddit"
- id: "InfinityForReddit"
- id: "VSCO"
- id: "Pixiv"
# - id: "Trakt"
- id: "MemeGenerator"
- id: "Lightroom"
- id: "Tumblr"
env:
RELEASE_VERSION: ${{ needs.generate-release.outputs.version }}
steps:
- uses: actions/setup-java@v4
with:
distribution: "adopt"
java-version: "20"
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Generate ${{ matrix.id }} config
run: |
./gen_sep_config.sh config.toml ${{ matrix.id }} sep_config.toml
cat sep_config.toml
- name: Build modules/APKs
continue-on-error: true
run: |
count=0
if ! ./build.sh sep_config.toml; then
count=$((count+1))
if [ $count -lt 2 ]; then
rm -rf temp build
./build.sh sep_config.toml
else
echo "Failed to build ${{ matrix.id }} after 3 attempts"
exit 1
fi
fi
env:
NEXT_VER_CODE: ${{ env.RELEASE_VERSION }}
- name: Get output
id: get_output
if: ${{ matrix.id == 'YouTube' }} && success()
run: |
DELIM="$(openssl rand -hex 8)"
echo "BUILD_LOG<<${DELIM}" >> "$GITHUB_OUTPUT"
cat build.md >> "$GITHUB_OUTPUT"
echo "${DELIM}" >> "$GITHUB_OUTPUT"
cp -f build.md build.tmp
- name: Upload modules to release
if: success()
run: |
# get all apk files in ./build/* directory, for each run gh release upload
for file in $(find build -type f -name "*.apk"); do
gh release upload ${{ env.RELEASE_VERSION }} $file
done
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release-metadata:
needs: [generate-release, run]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare build.md
run: |
cp extras.sh /tmp/extras.sh
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git fetch
git checkout update
filename="build.md"
/tmp/extras.sh "revanced/revanced-integrations" "revanced/revanced-patches" "revanced/revanced-cli" > $filename
echo -e "\n\n" >> $filename
/tmp/extras.sh "inotia00/revanced-integrations" "inotia00/revanced-patches" "inotia00/revanced-cli" >> $filename
echo -e "\n\n" >> $filename
/tmp/extras.sh "anddea/revanced-integrations" "anddea/revanced-patches" "revanced/revanced-cli" >> $filename
cat $filename
git add $filename
git commit -m "Bump version ${{ needs.generate-release.outputs.version }}"
git push
release:
needs: [generate-release, run]
runs-on: ubuntu-latest
steps:
- name: Mark release non-draft
run: |
if [[ ${{ github.ref_name }} == 'main' ]]; then
gh release edit ${{ needs.generate-release.outputs.version }} --draft=false --latest --repo ${{ github.repository }}
else
gh release edit ${{ needs.generate-release.outputs.version }} --draft=false --prerelease --repo ${{ github.repository }}
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
telegram-notify:
if: ${{ github.ref_name == 'main' }}
needs: [generate-release, run, release]
name: Notify Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10' # The python version to use.
cache: 'pip'
cache-dependency-path: 'telegram-script/requirements.txt'
- name: Install dependencies
run: pip install -r telegram-script/requirements.txt
- name: Run telegram notification script
run: python3 telegram-script
- name: Telegram Channel Update
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: markdown
message_file: release_notification.md
push-notify:
if: ${{ github.ref_name == 'main' }}
needs: [generate-release, run, release]
name: Push Notification
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11' # The python version to use.
cache: 'pip'
cache-dependency-path: 'push-notify/requirements.txt'
- name: Install dependencies
run: pip install -r push-notify/requirements.txt
- name: Create google-auth json
run: echo "${{ secrets.GOOGLE_AUTH_JSON }}" | base64 -d > google-services.json
- name: Run push notification script
run: |
release_tag="${{ needs.generate-release.outputs.version }}"
release_body=$(gh release view $release_tag --json body -q .body)
python3 push-notify --title "New Release $release_tag" --body "$release_body" --api_url ${{ secrets.NOTIF_API_URL }} --bearer ${{ secrets.NOTIF_API_BEARER }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}