git commit -m "fix(build): reference correct path for wlanpi_v8_defco… #23
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: 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: Verify Custom Config File Presence | |
- name: Verify Custom Config File Presence | |
run: | | |
echo "Verifying presence of wlanpi_v8_defconfig in build/ directory..." | |
if [ -f build/wlanpi_v8_defconfig ]; then | |
echo "wlanpi_v8_defconfig found." | |
else | |
echo "ERROR: wlanpi_v8_defconfig not found in build/ directory." | |
exit 1 | |
fi | |
# Step 7: Make the build script executable | |
- name: Make Build Script Executable | |
run: chmod +x build/build-wlanpi-kernel.sh | |
# Step 8: Execute the build script | |
- name: Execute Build Script | |
id: build-kernel | |
run: ./build/build-wlanpi-kernel.sh | |
# Step 9: 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 and build date from $DEB_FILE..." | |
# Extract the version and build date from the .deb filename | |
# Expected filename format: wlanpi-kernel-bookworm_<version>_arm64.deb | |
FILENAME=$(basename "$DEB_FILE" .deb) | |
VERSION=$(echo "$FILENAME" | grep -Po 'wlanpi-kernel-bookworm_\K[^_]+') | |
BUILD_DATE=$(echo "$VERSION" | grep -Po '[0-9]{8}$') | |
KERNEL_VERSION="${VERSION%-${BUILD_DATE}}" | |
echo "KERNEL_VERSION=${KERNEL_VERSION}" >> $GITHUB_ENV | |
echo "BUILD_DATE=${BUILD_DATE}" >> $GITHUB_ENV | |
echo "PACKAGE_NAME=wlanpi-kernel-bookworm" >> $GITHUB_ENV | |
echo "PACKAGE_VERSION=${VERSION}" >> $GITHUB_ENV | |
# Step 10: 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 11: 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 }}-${{ env.KERNEL_VERSION }} | |
path: output/*.deb | |