forked from j-hc/revanced-magisk-module
-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (86 loc) · 3.27 KB
/
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
name: Build Modules
on: [workflow_call, workflow_dispatch]
jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-java@v3
with:
distribution: "zulu"
java-version: "17"
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- name: Get next version code
id: next_ver_code
run: |
TAG=$(git tag --sort=creatordate | tail -1)
if [ -z "$TAG" ]; then TAG=0; fi
echo "NEXT_VER_CODE=$((TAG + 1))" >> $GITHUB_OUTPUT
- name: Build modules/APKs
run: ./build.sh build
env:
GITHUB_REPOSITORY: $GITHUB_REPOSITORY
NEXT_VER_CODE: ${{ steps.next_ver_code.outputs.NEXT_VER_CODE }}
- name: Get output
id: get_output
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
cd build
yt_op=$(find . -maxdepth 1 -name "youtube-revanced-magisk-*.zip" -printf '%P')
if [ -z "$yt_op" ]; then
echo "RELEASE_NAME=ReVanced" >> $GITHUB_OUTPUT
else
echo "RELEASE_NAME=$yt_op" >> $GITHUB_OUTPUT
fi
- name: Upload modules to release
uses: svenstaro/upload-release-action@v2
with:
body: ${{ steps.get_output.outputs.BUILD_LOG }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./build/*
release_name: ${{ steps.get_output.outputs.RELEASE_NAME }}
tag: ${{ steps.next_ver_code.outputs.NEXT_VER_CODE }}
file_glob: true
overwrite: false
- name: Switch to update branch
run: git checkout -f update || git switch --discard-changes --orphan update
- name: Update changelog and Magisk update jsons
id: update_config
run: |
cp -f build.tmp build.md
get_update_json() {
echo "{
\"version\": \"$1\",
\"versionCode\": $2,
\"zipUrl\": \"$3\",
\"changelog\": \"https://raw.githubusercontent.com/$GITHUB_REPOSITORY/update/build.md\"
}"
}
cd build || echo "build folder not found"
for OUTPUT in *revanced*.zip; do
[ "$OUTPUT" = "*revanced*.zip" ] && continue
ZIP_S=$(unzip -p "$OUTPUT" module.prop)
if ! UPDATE_JSON=$(echo "$ZIP_S" | grep updateJson); then
continue
fi
UPDATE_JSON="${UPDATE_JSON##*/}"
VER=$(echo "$ZIP_S" | grep version=)
VER="${VER##*=}"
DLURL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/download/${{ steps.next_ver_code.outputs.NEXT_VER_CODE }}/${OUTPUT}"
get_update_json "$VER" "${{ steps.next_ver_code.outputs.NEXT_VER_CODE}}" "$DLURL" "$CHANGELOG_URL" >"../$UPDATE_JSON"
done
cd ..
find . -name "*.json" | grep . || : >dummy.json
- uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: update
skip_checkout: true
file_pattern: build.md *.json
commit_message: Bump version ${{ steps.next_ver_code.outputs.NEXT_VER_CODE }}