Skip to content

Build Kernel BoardFamily #8

Build Kernel BoardFamily

Build Kernel BoardFamily #8

name: Build Kernel BoardFamily
on:
workflow_dispatch:
inputs:
BOARD:
description: 'Board type'
required: true
default: 'cyber-aib-rk3588'
type: choice
options:
- cyber-aib-rk3588
BRANCH:
description: 'Armbian kernel branch'
default: 'current'
required: false
type: choice
options:
- legacy
- vendor
- current
- edge
RELEASE:
description: 'Release name'
default: 'bookworm'
required: true
type: choice
options:
- jammy
- noble
- bullseye
- bookworm
Version:
description: 'Armbian Kernel Version'
default: 'v24.11'
required: false
type: choice
options:
- main
- v24.11
- v24.08
BOOT_LOGO:
description: 'Include boot logo'
default: 'yes'
required: false
type: choice
options:
- yes
- no
env:
TZ: America/New_York
jobs:
build-armbian-kernel:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Initialization environment
id: init
env:
DEBIAN_FRONTEND: noninteractive
run: |
# 清理 Docker 镜像和软件缓存
docker_images_ids=$(docker images -q)
if [ -n "$docker_images_ids" ]; then
docker rmi $docker_images_ids
fi
docker image prune -a -f
sudo -E apt-get -y purge azure-cli ghc* zulu* llvm* firefox google* dotnet* openjdk* mysql* php* mongodb* dotnet* moby* snapd* android* || true
sudo -E apt-get -qq autoremove --purge
sudo -E apt-get -qq clean
# 设置时区并创建工作目录
sudo timedatectl set-timezone "${TZ}"
sudo mkdir -p /mnt/workdir
sudo chown $USER:$GROUPS /mnt/workdir
df -Th
- name: Download source code
working-directory: /mnt/workdir
run: |
df -hT ${PWD}
git clone -q --single-branch --depth=1 --branch=${{ github.event.inputs.Version }} https://github.com/armbian/build.git build
ln -sf /mnt/workdir/build $GITHUB_WORKSPACE/build
cd build/
# 复制 config 和 userpatches 目录文件
cp -rf ${{ github.workspace }}/addboard/config/* config
mkdir -p userpatches
cp -rf ${{ github.workspace }}/addboard/userpatches/* userpatches
ls -la
- name: Compile Armbian Kernel [ ${{ inputs.RELEASE }} ]
run: |
cd /mnt/workdir/build/
./compile.sh BOARD=${{ inputs.BOARD }} RELEASE=${{ inputs.RELEASE }} BRANCH=${{ inputs.BRANCH }} BUILD_MINIMAL=no \
BUILD_DESKTOP=no KERNEL_CONFIGURE=no COMPRESS_OUTPUTIMAGE=sha,xz BOOT_LOGO=${{ inputs.BOOT_LOGO }}
- name: Prepare Kernel Release Metadata
run: |
cd "${GITHUB_WORKSPACE}/build/output/packages-hashed/"
# 查找并列出所有匹配的文件,按修改时间排序,取最新的一个
latest_file=$(find . -maxdepth 1 -type f -name 'kernel-*.tar' -print0 | xargs -0 ls -t | head -n 1)
if [ -z "$latest_file" ]; then
echo "No matching file found."
else
# 获取文件名而不包括路径
base_name=$(basename "$latest_file")
# 提取版本号及其之前的部分作为新文件名
new_base_name=$(echo "$base_name" | sed -n 's/kernel-$[^_]*$[^.]*/\1.tar/p')
# 检查是否成功提取了新文件名
if [ -z "$new_base_name" ]; then
echo "Failed to extract the new filename from $base_name"
else
# 重命名文件
mv "$latest_file" "$new_base_name"
echo "Renamed file $base_name to: $new_base_name"
# 列出目录中的文件以验证重命名
ls -l
echo "Directory listing after renaming:"
find . -maxdepth 1 -type f
# 设置环境变量
echo "new_base_name=${new_base_name}" >> $GITHUB_ENV
fi
fi
- name: Upload Kernel Packages to Release
if: success()
uses: ncipollo/release-action@main
with:
tag: "Armbian_Kernel"
name: "Armbian_Kernel"
artifacts: "${{ github.workspace }}/build/output/packages-hashed/${{ env.new_base_name }}"
allowUpdates: true
removeArtifacts: false
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
body: |
### Armbian Kernel Packages
- The kernel can be used to compile Armbian
- Usage method: After unzipping, install the deb packages in order
- Deb Packages: linux-dtb | linux-headers | linux-image | linux-libc-dev
draft: false
prerelease: false