Skip to content

PACKAGE_NAME: Set to wlanpi-kernel-bookworm consistently across both … #17

PACKAGE_NAME: Set to wlanpi-kernel-bookworm consistently across both …

PACKAGE_NAME: Set to wlanpi-kernel-bookworm consistently across both … #17

name: Build WLAN Pi Kernel for Debian Bookworm
on:
push:
branches:
- 6.12-bookworm
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-24.04
env:
DISTRO: bookworm
VERSION_CODENAME: bookworm
KERNEL_TARGET_DISTRO: Debian
KERNEL_TARGET_VERSION: bookworm
steps:
# Step 1: Checkout the repository
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0
# Step 2: Restore APT Cache
- name: Restore APT Cache
uses: actions/cache@v3
with:
path: cache-apt
key: ${{ runner.os }}-apt-${{ hashFiles('**/build/build-wlanpi-kernel.sh') }}
restore-keys: |
${{ runner.os }}-apt-
# Step 3: Prepare APT Cache for Caching
- name: Prepare APT Cache for Caching
run: |
mkdir -p cache-apt
find /var/cache/apt/archives -path /var/cache/apt/archives/partial -prune -o -type f -name '*.deb' -exec cp {} cache-apt/ \;
# Step 4: Install Dependencies
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential git libncurses-dev flex bison libssl-dev \
bc libelf-dev libudev-dev libpci-dev libiberty-dev autoconf automake libtool \
libpython3-dev crossbuild-essential-arm64 dpkg-dev gcc-aarch64-linux-gnu
# Step 5: Cache Kernel Build Directory
- name: Cache Kernel Build Directory
uses: actions/cache@v3
with:
path: linux
key: ${{ runner.os }}-kernel-${{ hashFiles('**/build/build-wlanpi-kernel.sh') }}
restore-keys: |
${{ runner.os }}-kernel-
# Step 6: Make the build script executable
- name: Make Build Script Executable
run: chmod +x build/build-wlanpi-kernel.sh
# Step 7: Execute the build script
- name: Execute Build Script
id: build-kernel
run: ./build/build-wlanpi-kernel.sh
# Step 8: Extract Kernel Version and Date
- name: Extract Kernel Version and Date
id: version-info
run: |
DEB_FILE=$(ls output/*.deb | head -n 1)
DEB_COUNT=$(ls output/*.deb | wc -l)
if [ "$DEB_COUNT" -ne 1 ]; then
echo "ERROR: Expected exactly one .deb file, found $DEB_COUNT."
exit 1
fi
echo "Extracting kernel version from $DEB_FILE..."
# Extract the version from the .deb filename
KERNEL_VERSION=$(echo "$(basename "$DEB_FILE")" | grep -Po 'wlanpi-kernel-bookworm_\K[^_]+')
BUILD_DATE=$(echo "$(basename "$DEB_FILE")" | grep -Po 'wlanpi-kernel-bookworm_[^_]+_\K[^_]+')
PACKAGE_NAME="wlanpi-kernel-bookworm"
PACKAGE_VERSION=$(echo "$(basename "$DEB_FILE")" | grep -Po 'wlanpi-kernel-bookworm_\K[^_]+')
echo "KERNEL_VERSION=$KERNEL_VERSION" >> $GITHUB_ENV
echo "BUILD_DATE=$BUILD_DATE" >> $GITHUB_ENV
echo "PACKAGE_NAME=$PACKAGE_NAME" >> $GITHUB_ENV
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
# Step 9: Debug Kernel and Package Versions
- name: Debug Kernel and Package Versions
run: |
echo "Kernel Version: ${{ env.KERNEL_VERSION }}"
echo "Build Date: ${{ env.BUILD_DATE }}"
echo "Package Name: ${{ env.PACKAGE_NAME }}"
echo "Package Version: ${{ env.PACKAGE_VERSION }}"
# Step 10: Upload Debian Package as Artifact
- name: Upload Debian Package
uses: actions/upload-artifact@v4 # Updated to v4 to avoid deprecation warnings
with:
name: ${{ env.PACKAGE_NAME }}-bookworm
path: output/*.deb