generated from j-hc/revanced-magisk-module
-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (55 loc) · 2.16 KB
/
ci.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
name: CI
on:
workflow_dispatch:
schedule:
- cron: "0 16 * * *"
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Should build?
id: should_build
shell: bash
run: |
source build.conf
source utils.sh
is_youtube_latest() {
if [[ $YT_PATCHER_ARGS == *"--experimental"* ]]; then
declare -r cur_yt=$(sed -n 's/.*YouTube version: \(.*\)/\1/p' latest_build.md | xargs)
[ -z "$cur_yt" ] && return 1 # empty, fail=>dont build
declare -r last_ver=$(get_apk_vers "https://www.apkmirror.com/uploads/?appcategory=youtube" | get_largest_ver)
echo "current yt version: $cur_yt"
echo "latest yt version: $last_ver"
[ "$cur_yt" != "$last_ver" ] # test success=>build, fail=>dont build
else
return 1 # not experimental, dont build
fi
}
is_patches_latest() {
declare -r last_patches_url=$(wget -nv -O- https://api.github.com/repos/revanced/revanced-patches/releases/latest | tr -d ' ' | sed -n 's/.*"browser_download_url":"\(.*jar\)".*/\1/p')
declare -r last_patches=${last_patches_url##*/}
cur_patches=$(sed -n 's/.*Patches: \(.*\)/\1/p' latest_build.md | xargs)
echo "current patches version: $cur_patches"
echo "latest patches version: $last_patches"
[ "$cur_patches" != "$last_patches" ] # test success=>build, fail=>dont build
}
if ! git checkout update; then
echo "first time building!"
echo ::set-output name=SHOULD_BUILD::1
elif is_patches_latest || is_youtube_latest; then
echo "build!"
echo ::set-output name=SHOULD_BUILD::1
else
echo "dont build!"
echo ::set-output name=SHOULD_BUILD::0
fi
outputs:
SHOULD_BUILD: ${{ steps.should_build.outputs.SHOULD_BUILD }}
build:
needs: check
uses: ./.github/workflows/build.yml
if: ${{ needs.check.outputs.SHOULD_BUILD == 1 }}