1+ name : Build Android Kernel then ship it in an AnyKernel3 flashable zip
2+
3+ on :
4+ push :
5+ branches :
6+ - polaris
7+ pull_request :
8+ branches :
9+ - polaris
10+ workflow_dispatch :
11+
12+ jobs :
13+ build :
14+ runs-on : ubuntu-22.04
15+
16+ steps :
17+ - name : ⚡ Checkout kernel's sourcecode and clone submodules
18+ uses : actions/checkout@v4
19+
20+ - name : 🔄 Update KernelSU-Next
21+ run : |
22+ rm -rf KernelSU-Next
23+ git clone https://github.com/KernelSU-Next/KernelSU-Next
24+
25+ - name : 📥 Clone AnyKernel3
26+ run : |
27+ git clone -b b1c1 https://github.com/Oneloutre/AnyKernel3.git anykernel
28+ rm -rf anykernel/.git
29+
30+ - name : 📦 Install dépendencies
31+ run : |
32+ sudo apt-get update -y -qq
33+ sudo apt-get install -y --no-install-recommends \
34+ python3-pip \
35+ git \
36+ zip \
37+ unzip \
38+ gcc \
39+ g++ \
40+ make \
41+ ninja-build \
42+ file \
43+ bc \
44+ bison \
45+ flex \
46+ libfl-dev \
47+ libssl-dev \
48+ libelf-dev \
49+ wget \
50+ build-essential \
51+ python3-dev \
52+ python3-setuptools \
53+ rsync \
54+ ccache \
55+ llvm-dev
56+ sudo apt install flex libncurses6 libncurses5 binutils-aarch64-linux-gnu device-tree-compiler \
57+ android-sdk-libsparse-utils python2
58+ sudo apt install -y gcc-arm-linux-gnueabi
59+ echo "CROSS_COMPILE_ARM32=arm-linux-gnueabi-" >> $GITHUB_ENV
60+
61+ - name : 🔧 Install Clang from a Github action
62+ uses : KyleMayes/install-llvm-action@v2
63+ with :
64+ version : " 18.1.8"
65+ directory : ${{ runner.temp }}/llvm
66+
67+ - name : 🔧 Add Clang to the PATH
68+ run : |
69+ echo "${{ runner.temp }}/llvm/bin" >> $GITHUB_PATH
70+
71+ - name : 🛠 Use repo's mkdtimg
72+ run : |
73+ chmod +x tools/mkdtimg
74+ sudo mv tools/mkdtimg /usr/local/bin/mkdtimg
75+
76+ - name : 🔍 Device's codename and kernel's version
77+ run : |
78+ DEVICE_CODENAME=Hayasaka-polaris
79+ KERNEL_VERSION=$(make kernelversion)
80+
81+ echo "Device Codename: $DEVICE_CODENAME"
82+ echo "Kernel Version: $KERNEL_VERSION"
83+
84+ echo "DEVICE_CODENAME=$DEVICE_CODENAME" >> $GITHUB_ENV
85+ echo "KERNEL_VERSION=$KERNEL_VERSION" >> $GITHUB_ENV
86+
87+ - name : 🚀 Enable ccache to speed the build up
88+ uses : hendrikmuhs/ccache-action@v1.2
89+ with :
90+ max-size : 7G
91+
92+ - name : 🛠️ Build the kramel
93+ run : |
94+ export ARCH=arm64
95+ export SUBARCH=arm64
96+ export KBUILD_COMPILER_STRING=$(clang --version | head -n 1)
97+ export CCACHE_EXEC=$(which ccache)
98+ export KBUILD_BUILD_HOST="Hayasaka-Github-actions-Onelots"
99+
100+ make O=out ARCH=arm64 vendor/xiaomi/mi845_defconfig vendor/debugfs.config vendor/kernelsu.config vendor/xiaomi/polaris.config V=1
101+ make O=out ARCH=arm64 olddefconfig
102+ make -j$(nproc --all) O=out -j"$(nproc --all)" \
103+ ARCH=arm64 \
104+ CC="ccache clang" \
105+ LLVM=1 \
106+ LLVM_IAS=1 \
107+ CLANG_TRIPLE=aarch64-linux-gnu- \
108+ CROSS_COMPILE=aarch64-linux-android- \
109+ CROSS_COMPILE_ARM32=arm-linux-androideabi-
110+
111+ - name : 🚀 Copy the compiled kernel to AnyKernel3 then create the zip
112+ run : |
113+ ZIP_NAME="Kernel-${DEVICE_CODENAME}-${KERNEL_VERSION}-$(date +%d%m%Y).zip"
114+
115+ cp out/arch/arm64/boot/Image.gz-dtb anykernel/
116+
117+ cd anykernel && zip -r9 $ZIP_NAME ./*
118+ mv $ZIP_NAME ../
119+
120+ echo "ZIP_NAME=$ZIP_NAME" >> $GITHUB_ENV
121+
122+ - name : 📤 Publish github release
123+ uses : softprops/action-gh-release@v2
124+ with :
125+ files : ${{ env.ZIP_NAME }}
126+ tag_name : " latest"
127+ draft : false
128+ prerelease : false
129+
130+ - name : 📤 Publish with tag associated to the kernel
131+ uses : softprops/action-gh-release@v2
132+ with :
133+ files : ${{ env.ZIP_NAME }}
134+ tag_name : " ${{ env.ZIP_NAME }}"
135+ draft : false
136+ prerelease : false
137+
138+ - name : 🚀 Notify people on Discord
139+ env :
140+ DEVICE_CODENAME : ${{ env.DEVICE_CODENAME }}
141+ KERNEL_VERSION : ${{ env.KERNEL_VERSION }}
142+ WEBHOOK : ${{ secrets.WEBHOOK }}
143+ NAME : ${{ env.ZIP_NAME }}
144+ run : |
145+ python3 .github/webhook.py
0 commit comments