forked from ShirkNeko/GKI_KernelSU_SUSFS
-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (79 loc) · 3.55 KB
/
get-manager.yml
File metadata and controls
87 lines (79 loc) · 3.55 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
name: GetManager
permissions:
contents: write # Allow writing to repository contents (for pushing tags)
actions: read # Allows triggering actions
on:
workflow_call: # This allows this workflow to be called from another workflow
inputs:
kernelsu_variant:
required: true
type: string
jobs:
get_ksu_manager:
runs-on: ubuntu-latest
env:
CCACHE_COMPILERCHECK: "%compiler% -dumpmachine; %compiler% -dumpversion"
CCACHE_NOHASHDIR: "true"
CCACHE_HARDLINK: "true"
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: 安装依赖
run: sudo apt update && sudo apt upgrade -y && sudo apt install -y git curl jq
- name: 设定 KSU 环境变量
run: |
if [ "${{ inputs.kernelsu_variant }}" == "Next" ]; then
echo "This is the Next variant"
git clone https://github.com/KernelSU-Next/KernelSU-Next.git
cd KernelSU-Next
KSU_GIT_VERSION=$(git rev-list --count HEAD)
# ???
KSU_VERSION=$((10000 + KSU_GIT_VERSION + 200))
echo $KSU_VERSION
echo "KSU_VERSION=$KSU_VERSION" >> $GITHUB_ENV
elif [ "${{ inputs.kernelsu_variant }}" == "SukiSU" ]; then
echo "This is the SukiSU variant"
git clone https://github.com/SukiSU-Ultra/SukiSU-Ultra.git
cd SukiSU-Ultra
KSU_GIT_VERSION=$(git rev-list --count HEAD)
KSU_VERSION=$((10000 + KSU_GIT_VERSION + 606))
echo $KSU_VERSION
echo "KSU_VERSION=$KSU_VERSION" >> $GITHUB_ENV
else
echo "Unknown variant"
fi
- name: 添加 KernelSU
run: |
if [ "${{ inputs.kernelsu_variant }}" == "Next" ]; then
echo "KernelSU Next..."
REPO="KernelSU-Next/KernelSU-Next"
FILENAME="build-manager-ci.yml"
elif [ "${{ inputs.kernelsu_variant }}" == "SukiSU" ]; then
echo "SukiSU..."
REPO="SukiSU-Ultra/SukiSU-Ultra"
FILENAME="build-manager.yml"
fi
# 获取最新成功构建的 ID
BUILD_ID=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/$REPO/actions/workflows/$FILENAME/runs?status=success" | \
jq -r '.workflow_runs[0].id')
echo 'BUILD_ID=$BUILD_ID'
# 获取该构建的 Artifacts
ARTIFACTS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/$REPO/actions/runs/$BUILD_ID/artifacts")
echo 'ARTIFACTS=$ARTIFACTS'
# 获取 Manager 文件的下载链接
if [ "${{ inputs.kernelsu_variant }}" == "Next" ]; then
DOWNLOAD_URL=$(echo "$ARTIFACTS" | jq -r '.artifacts[] | select(.name == "Manager") | .archive_download_url')
elif [ "${{ inputs.kernelsu_variant }}" == "SukiSU" ]; then
DOWNLOAD_URL=$(echo "$ARTIFACTS" | jq -r '.artifacts[] | select(.name == "manager") | .archive_download_url')
fi
# 下载 Manager 文件
curl -L -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -o "${{ inputs.kernelsu_variant }}-管理器(${{ env.KSU_VERSION }}).zip" "$DOWNLOAD_URL"
echo "Manager 文件已下载为:${{ inputs.kernelsu_variant }}-管理器(${{ env.KSU_VERSION }}).zip"
unzip *.zip
- name: 上传编译资产
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.kernelsu_variant }}-Manager(${{ env.KSU_VERSION }})
path: |
*.apk