Linux Kernel 6.12 LTS #397
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Linux Kernel 6.6 LTS | |
on: | |
schedule: | |
- cron: 0 23 * * * | |
jobs: | |
build: | |
name: Build Linux Kernel | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Set timezone & hostname | |
run: | | |
sudo timedatectl set-timezone 'Asia/Shanghai' | |
sudo hostnamectl set-hostname "builder" | |
- name: Show system | |
run: | | |
echo -e "\n\e[1;32mCPU:\e[0m" | |
echo "$(grep 'model name' /proc/cpuinfo | head -1 | awk -F ': ' '{print $2}') ($(grep 'cpu MHz' /proc/cpuinfo | head -1 | awk -F ': ' '{print $2}')MHz) x $(grep processor /proc/cpuinfo | wc -l)" | |
echo -e "\n\e[1;32mMemory:\e[0m" | |
free -h | |
echo -e "\n\e[1;32mStorage:\e[0m" | |
df -Th / /mnt | |
echo -e "\n\e[1;32mSystem:\e[0m" | |
lsb_release -a | |
echo -e "\n\e[1;32mKernel:\e[0m" | |
uname -a | |
echo | |
- name: Free disk space | |
uses: sbwml/actions@free-disk | |
- name: Checkout | |
uses: actions/checkout@main | |
- name: Init centos rootfs | |
run: | | |
wget https://github.com/sbwml/kernel-latest-centos/releases/download/rootfs/rootfs.tar.xz >/dev/null 2>&1 | |
tar xf rootfs.tar.xz && rm -f rootfs.tar.xz | |
echo "rootfs=$(pwd)/rootfs" >> "$GITHUB_ENV" | |
sudo mount -o bind /dev rootfs/dev | |
sudo mount -t proc /proc rootfs/proc | |
- name: Install LLVM | |
uses: sbwml/actions@install-llvm | |
- name: Build Linux Kernel | |
run: | | |
sudo cp -a build_kernel.sh ${{ env.rootfs }} | |
sudo cp -a config ${{ env.rootfs }}/root | |
sudo cp -a kernel.spec ${{ env.rootfs }}/root | |
sudo cp -a src ${{ env.rootfs }}/root | |
sudo cp -a repo/devtoolset-12.repo ${{ env.rootfs }}/etc/yum.repos.d | |
sudo cp -a /opt/clang ${{ env.rootfs }}/opt | |
sudo chroot ${{ env.rootfs }} /bin/bash /build_kernel.sh | |
if [ -f ${{ env.rootfs }}/VERSION ]; then | |
echo 'kernel_version<<EOF' >> $GITHUB_ENV | |
cat ${{ env.rootfs }}/VERSION >> $GITHUB_ENV | |
echo 'EOF' >> $GITHUB_ENV | |
echo "new_version=true" >> $GITHUB_ENV | |
fi | |
- name: Upload Artifacts | |
if: env.new_version == 'true' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: kernel-${{ env.kernel_version }} | |
path: ${{ env.rootfs }}/rpm.tar.gz | |
- name: Create release | |
if: env.new_version == 'true' | |
uses: ncipollo/[email protected] | |
with: | |
name: kernel-${{ env.kernel_version }} | |
allowUpdates: true | |
tag: ${{ env.kernel_version }} | |
commit: main | |
replacesArtifacts: true | |
token: ${{ secrets.workflow_token }} | |
artifacts: ${{ env.rootfs }}/rpm/* | |
- name: Set user groups | |
if: env.new_version == 'true' | |
run: | | |
sudo chown -R runner.runner ${{ env.rootfs }}/x86_64 ${{ env.rootfs }}/SRPMS | |
- name: Upload FTP - RPM | |
if: env.new_version == 'true' | |
uses: sbwml/FTP-Deploy-Action@master | |
with: | |
server: ${{ secrets.ftp_address }} | |
username: ${{ secrets.ftp_username }} | |
password: ${{ secrets.ftp_password }} | |
local-dir: ${{ env.rootfs }}/x86_64/ | |
server-dir: "7/x86_64/" | |
dangerous-clean-slate: true | |
- name: Upload FTP - SRPM | |
if: env.new_version == 'true' | |
uses: sbwml/FTP-Deploy-Action@master | |
with: | |
server: ${{ secrets.ftp_address }} | |
username: ${{ secrets.ftp_username }} | |
password: ${{ secrets.ftp_password }} | |
local-dir: ${{ env.rootfs }}/SRPMS/ | |
server-dir: "7/SRPMS/" | |
dangerous-clean-slate: false | |
- name: Create metadata | |
if: env.new_version == 'true' | |
run: | | |
sshpass -p ${{ secrets.server_password }} ssh -o StrictHostKeyChecking=no root@${{ secrets.ftp_address }} >/dev/null 2>&1 | |
sshpass -p ${{ secrets.server_password }} ssh root@${{ secrets.ftp_address }} "/opt/sbin/create_metadata" |