Skip to content
This repository was archived by the owner on Oct 12, 2025. It is now read-only.

Commit 6bfb243

Browse files
committed
polaris: kernel_auto_builder: introduce hayasaka to auto building
Signed-off-by: Onelots <onelots@onelots.fr>
1 parent c4dbff4 commit 6bfb243

3 files changed

Lines changed: 191 additions & 0 deletions

File tree

‎.github/webhook.py‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import os
2+
import requests
3+
import datetime
4+
5+
DISCORD_WEBHOOK = os.environ["WEBHOOK"]
6+
release_url = "https://github.com/Oneloutre/kernel_auto_builder/releases/tag/latest"
7+
codename = os.environ["DEVICE_CODENAME"]
8+
kernel_version = os.environ["KERNEL_VERSION"]
9+
zip_name = os.environ["NAME"]
10+
embed_color = 0x2ecc71
11+
12+
embed = {
13+
"type": "rich",
14+
"username": "Kramel Slave",
15+
"embeds": [
16+
{
17+
"title": f"🚀 Build succeeded !",
18+
"url": release_url,
19+
"description": f"The KernelSU-Next build for **{codename}** is done !\n🎯 **Version :** `{kernel_version}`\n💡 **Name :** `{zip_name}`",
20+
"color": f"{embed_color}",
21+
"fields": [
22+
{
23+
"name": "📥 Download",
24+
"value": f"[Click here to go to the download page]({release_url})",
25+
"inline": False
26+
},
27+
{
28+
"name": "📅 Date",
29+
"value": f"{datetime.datetime.now().strftime('%d/%m/%Y %H:%M:%S')}",
30+
"inline": True
31+
}
32+
],
33+
"footer": {
34+
"text": "Automated build • GitHub Actions",
35+
"icon_url": "https://cdn-icons-png.flaticon.com/512/733/733609.png"
36+
}
37+
}
38+
]
39+
}
40+
41+
response = requests.post(DISCORD_WEBHOOK, json=embed)
42+
if response.status_code == 204:
43+
print("✅ Notification sent on Discord !")
44+
else:
45+
print(f"❌ Error ({response.status_code}) : {response.text}")

‎.github/workflows/kernel_build.yml‎

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
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

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ Module.symvers
6969
!.gitignore
7070
!.mailmap
7171
!.cocciconfig
72+
!.github
7273

7374
#
7475
# Generated include files

0 commit comments

Comments
 (0)