From aaf8a67aeb4524083074424ec6ba63ca719bd696 Mon Sep 17 00:00:00 2001 From: Nady <103646211+mohamedamrnady@users.noreply.github.com> Date: Tue, 12 Dec 2023 17:20:04 +0200 Subject: [PATCH] CI: Add localversion to filename (#111) * feat: Add localversion to filename * fix localversion directory * disable feature by default --- .github/workflows/build-kernel.yml | 14 ++++++++++---- config.env | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-kernel.yml b/.github/workflows/build-kernel.yml index b8702a1ee3..6df9077892 100644 --- a/.github/workflows/build-kernel.yml +++ b/.github/workflows/build-kernel.yml @@ -24,6 +24,7 @@ jobs: echo "KERNEL_CONFIG=$(cat $CONFIG_ENV | grep -w "KERNEL_CONFIG" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV echo "KERNEL_IMAGE_NAME=$(cat $CONFIG_ENV | grep -w "KERNEL_IMAGE_NAME" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV echo "ARCH=$(cat $CONFIG_ENV | grep -w "ARCH" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV + echo "ADD_LOCALVERSION_TO_FILENAME=$(cat $CONFIG_ENV | grep -w "ADD_LOCALVERSION_TO_FILENAME" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV echo "EXTRA_CMDS=$(cat $CONFIG_ENV | grep -w "EXTRA_CMDS" | head -n 1 | cut -d ":" -f 2)" >> $GITHUB_ENV echo "USE_CUSTOM_CLANG=$(cat $CONFIG_ENV | grep -w "USE_CUSTOM_CLANG" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV echo "CUSTOM_CLANG_SOURCE=$(cat $CONFIG_ENV | grep -w "CUSTOM_CLANG_SOURCE" | head -n 1 | cut -d "=" -f 2)" >> $GITHUB_ENV @@ -159,6 +160,11 @@ jobs: run: | cd $GITHUB_WORKSPACE/kernel_workspace git clone ${{ env.KERNEL_SOURCE }} -b ${{ env.KERNEL_SOURCE_BRANCH }} android-kernel --depth=1 + if [[ ${{ env.ADD_LOCALVERSION_TO_FILENAME }} == 'true' ]]; then + echo "LOCALVERSION=$(cat android-kernel/localversion)" >> $GITHUB_ENV + else + echo "LOCALVERSION=" >> $GITHUB_ENV + fi - name: Download source boot image if: env.BUILD_BOOT_IMG == 'true' @@ -203,7 +209,7 @@ jobs: if: env.ENABLE_CCACHE == 'true' uses: hendrikmuhs/ccache-action@v1.2 with: - key: build-kernel-${{ env.DEVICE }}${{ env.UPLOADNAME }} + key: build-kernel-${{ env.DEVICE }}${{ env.LOCALVERSION }}${{ env.UPLOADNAME }} max-size: 2G - name: Build kernel @@ -273,14 +279,14 @@ jobs: if: env.CHECK_FILE_IS_OK == 'true' uses: actions/upload-artifact@v3 with: - name: ${{ env.KERNEL_IMAGE_NAME }}${{ env.UPLOADNAME }}-${{ env.DEVICE }}-${{ env.BUILD_TIME }} + name: ${{ env.KERNEL_IMAGE_NAME }}${{ env.LOCALVERSION }}${{ env.UPLOADNAME }}-${{ env.DEVICE }}-${{ env.BUILD_TIME }} path: kernel_workspace/android-kernel/out/arch/${{ env.ARCH }}/boot/${{ env.KERNEL_IMAGE_NAME }} - name: Upload AnyKernel3 if: env.CHECK_FILE_IS_OK == 'true' uses: actions/upload-artifact@v3 with: - name: AnyKernel3${{ env.UPLOADNAME }}-${{ env.DEVICE }}-${{ env.BUILD_TIME }} + name: AnyKernel3${{ env.LOCALVERSION }}${{ env.UPLOADNAME }}-${{ env.DEVICE }}-${{ env.BUILD_TIME }} path: kernel_workspace/AnyKernel3/* - name: Upload DTBO image @@ -294,5 +300,5 @@ jobs: if: env.MAKE_BOOT_IMAGE_IS_OK == 'true' uses: actions/upload-artifact@v3 with: - name: boot${{ env.UPLOADNAME }}-${{ env.DEVICE }}-${{ env.BUILD_TIME }} + name: boot${{ env.LOCALVERSION }}${{ env.UPLOADNAME }}-${{ env.DEVICE }}-${{ env.BUILD_TIME }} path: kernel_workspace/boot.img diff --git a/config.env b/config.env index 4cfceb6725..2069835c93 100644 --- a/config.env +++ b/config.env @@ -5,6 +5,7 @@ KERNEL_SOURCE_BRANCH=twrp-12 KERNEL_CONFIG=vendor/wayne_defconfig KERNEL_IMAGE_NAME=Image.gz-dtb ARCH=arm64 +ADD_LOCALVERSION_TO_FILENAME=false EXTRA_CMDS:LD=ld.lld # Clang