@@ -286,6 +286,58 @@ runs:
286286 echo "CONFIG_IP6_NF_TARGET_HL=y" >> ./common/arch/arm64/configs/gki_defconfig
287287 echo "CONFIG_IP6_NF_MATCH_HL=y" >> ./common/arch/arm64/configs/gki_defconfig
288288
289+ - name : Save Build Metadata
290+ shell : bash
291+ id : save_metadata
292+ run : |
293+ CONFIG_DIR="$GITHUB_WORKSPACE/${{ env.CONFIG }}"
294+ ARTIFACTS_DIR="$CONFIG_DIR/artifacts"
295+ mkdir -p "$ARTIFACTS_DIR"
296+
297+ cd "$CONFIG_DIR/kernel_platform/common"
298+ CONFIG_FILES=("build.config.common" "build.config.constants")
299+ BRANCH_LINE=""
300+
301+ for file in "${CONFIG_FILES[@]}"; do
302+ if [ -f "$file" ]; then
303+ line=$(grep '^[[:space:]]*BRANCH=' "$file" | head -n1 || true)
304+ if [ -n "$line" ]; then
305+ BRANCH_LINE="$line"
306+ echo "Found BRANCH in: $file"
307+ break # Found it — exit loop
308+ else
309+ echo "File exists but no BRANCH= found: $file"
310+ fi
311+ else
312+ echo "File not found: $file"
313+ fi
314+ done
315+
316+ if [ -z "$BRANCH_LINE" ]; then
317+ echo "Error: No BRANCH= found in any of: ${CONFIG_FILES[*]}"
318+ exit 1
319+ fi
320+
321+ BRANCH_VALUE="${BRANCH_LINE#*=}"
322+ ANDROID_VERSION="${BRANCH_VALUE%-*}"
323+
324+ if [ -z "$ANDROID_VERSION" ]; then
325+ echo "Error: Could not extract 'androidXX' from BRANCH='$BRANCH_VALUE'"
326+ exit 1
327+ fi
328+
329+ # Extract values using grep and awk
330+ VERSION=$(grep '^VERSION *=' Makefile | awk '{print $3}')
331+ PATCHLEVEL=$(grep '^PATCHLEVEL *=' Makefile | awk '{print $3}')
332+ SUBLEVEL=$(grep '^SUBLEVEL *=' Makefile | awk '{print $3}')
333+ FULL_VERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL"
334+
335+ echo "Kernel Version: $ANDROID_VERSION-$FULL_VERSION"
336+
337+ cd "$ARTIFACTS_DIR"
338+ echo "$ANDROID_VERSION-$FULL_VERSION" > ${{ inputs.model }}.txt
339+ echo "KERNEL_VER=$ANDROID_VERSION-$FULL_VERSION" >> $GITHUB_ENV
340+
289341 - name : Run sed and perl Commands
290342 shell : bash
291343 run : |
@@ -296,12 +348,12 @@ runs:
296348 sed -i 's/CONFIG_LTO_CLANG_FULL=y/CONFIG_LTO_CLANG_THIN=y/' "./common/arch/arm64/configs/gki_defconfig"
297349 sed -i 's/CONFIG_LTO_CLANG_NONE=y/CONFIG_LTO_CLANG_THIN=y/' "./common/arch/arm64/configs/gki_defconfig"
298350 sed -i 's/check_defconfig//' ./common/build.config.gki
299- tac ./common/scripts/setlocalversion | sed '0,/echo "\$res"/s//res=\$\(echo \$res \| cut -d- -f1-2\)- OP-Wild\;echo "\$res"\;/' | tac > ./common/scripts/setlocalversion.tmp && mv ./common/scripts/setlocalversion.tmp ./common/scripts/setlocalversion
300- tac ./msm-kernel/scripts/setlocalversion | sed '0,/echo "\$res"/s//res=\$\(echo \$res \| cut -d- -f1-2\)- OP-Wild\;echo "\$res"\;/' | tac > ./msm-kernel/scripts/setlocalversion.tmp && mv ./msm-kernel/scripts/setlocalversion.tmp ./msm-kernel/scripts/setlocalversion
301- tac ./external/dtc/scripts/setlocalversion | sed '0,/echo "\$res"/s//res=\$\(echo \$res \| cut -d- -f1-2\)- OP-Wild\;echo "\$res"\;/' | tac > ./external/dtc/scripts/setlocalversion.tmp && mv ./external/dtc/scripts/setlocalversion.tmp ./external/dtc/scripts/setlocalversion
302- sed -i 's/echo "${KERNELVERSION}${file_localversion}${config_localversion}${LOCALVERSION}${scm_version}"/echo "${KERNELVERSION}-${{ inputs.android_version }}-OP-Wild"/' ./common/scripts/setlocalversion
303- sed -i 's/echo "${KERNELVERSION}${file_localversion}${config_localversion}${LOCALVERSION}${scm_version}"/echo "${KERNELVERSION}-${{ inputs.android_version }}-OP-Wild"/' ./msm-kernel/scripts/setlocalversion
304- sed -i 's/echo "${KERNELVERSION}${file_localversion}${config_localversion}${LOCALVERSION}${scm_version}"/echo "${KERNELVERSION}-${{ inputs.android_version }}-OP-Wild"/' ./external/dtc/scripts/setlocalversion
351+ tac ./common/scripts/setlocalversion | sed '0,/echo "\$res"/s//res="${{ env.KERNEL_VER }}- OP-Wild" \;echo "\$res"\;/' | tac > ./common/scripts/setlocalversion.tmp && mv ./common/scripts/setlocalversion.tmp ./common/scripts/setlocalversion
352+ tac ./msm-kernel/scripts/setlocalversion | sed '0,/echo "\$res"/s//res="${{ env.KERNEL_VER }}- OP-Wild" \;echo "\$res"\;/' | tac > ./msm-kernel/scripts/setlocalversion.tmp && mv ./msm-kernel/scripts/setlocalversion.tmp ./msm-kernel/scripts/setlocalversion
353+ tac ./external/dtc/scripts/setlocalversion | sed '0,/echo "\$res"/s//res="${{ env.KERNEL_VER }}- OP-Wild" \;echo "\$res"\;/' | tac > ./external/dtc/scripts/setlocalversion.tmp && mv ./external/dtc/scripts/setlocalversion.tmp ./external/dtc/scripts/setlocalversion
354+ sed -i 's/echo "${KERNELVERSION}${file_localversion}${config_localversion}${LOCALVERSION}${scm_version}"/echo "${{ env.KERNEL_VER }}-OP-Wild"/' ./common/scripts/setlocalversion
355+ sed -i 's/echo "${KERNELVERSION}${file_localversion}${config_localversion}${LOCALVERSION}${scm_version}"/echo "${{ env.KERNEL_VER }}-OP-Wild"/' ./msm-kernel/scripts/setlocalversion
356+ sed -i 's/echo "${KERNELVERSION}${file_localversion}${config_localversion}${LOCALVERSION}${scm_version}"/echo "${{ env.KERNEL_VER }}-OP-Wild"/' ./external/dtc/scripts/setlocalversion
305357 chmod +x ./common/scripts/setlocalversion
306358 chmod +x ./msm-kernel/scripts/setlocalversion
307359 chmod +x ./external/dtc/scripts/setlocalversion
@@ -430,67 +482,11 @@ runs:
430482 fi
431483 ZIP_NAME="AnyKernel3_${{ inputs.model }}_${{ inputs.android_version }}-${{ inputs.kernel_version }}_Next_${{ env.KSUVER }}_SUSFS_${{ env.SUSVER }}.zip"
432484 ARTIFACTS_DIR="$CONFIG_DIR/artifacts"
433- mkdir -p "$ARTIFACTS_DIR"
434485 echo "Creating zip file $ZIP_NAME in $ARTIFACTS_DIR..."
435486 zip -r "$ARTIFACTS_DIR/$ZIP_NAME" ./*
436487
437- - name : Save Build Metadata
438- shell : bash
439- if : success() && steps.create_zip.conclusion == 'success'
440- id : save_metadata
441- run : |
442- CONFIG_DIR="$GITHUB_WORKSPACE/${{ env.CONFIG }}"
443- ARTIFACTS_DIR="$CONFIG_DIR/artifacts"
444- cd "$ARTIFACTS_DIR"
445- if [ -z "$(ls *.zip 2>/dev/null)" ]; then
446- echo "No kernel zip found! Artifact upload might be fake."
447- exit 1
448- fi
449-
450- cd "$CONFIG_DIR/kernel_platform/common"
451- CONFIG_FILES=("build.config.common" "build.config.constants")
452- BRANCH_LINE=""
453-
454- for file in "${CONFIG_FILES[@]}"; do
455- if [ -f "$file" ]; then
456- line=$(grep '^[[:space:]]*BRANCH=' "$file" | head -n1 || true)
457- if [ -n "$line" ]; then
458- BRANCH_LINE="$line"
459- echo "Found BRANCH in: $file"
460- break # Found it — exit loop
461- else
462- echo "File exists but no BRANCH= found: $file"
463- fi
464- else
465- echo "File not found: $file"
466- fi
467- done
468-
469- if [ -z "$BRANCH_LINE" ]; then
470- echo "Error: No BRANCH= found in any of: ${CONFIG_FILES[*]}"
471- exit 1
472- fi
473-
474- BRANCH_VALUE="${BRANCH_LINE#*=}"
475- ANDROID_VERSION="${BRANCH_VALUE%-*}"
476-
477- if [ -z "$ANDROID_VERSION" ]; then
478- echo "Error: Could not extract 'androidXX' from BRANCH='$BRANCH_VALUE'"
479- exit 1
480- fi
481-
482- # Extract values using grep and awk
483- VERSION=$(grep '^VERSION *=' Makefile | awk '{print $3}')
484- PATCHLEVEL=$(grep '^PATCHLEVEL *=' Makefile | awk '{print $3}')
485- SUBLEVEL=$(grep '^SUBLEVEL *=' Makefile | awk '{print $3}')
486- FULL_VERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL"
487-
488- echo "Kernel Version: $ANDROID_VERSION-$FULL_VERSION"
489-
490- cd "$ARTIFACTS_DIR"
491- echo "$ANDROID_VERSION-$FULL_VERSION" > ${{ inputs.model }}.txt
492-
493488 - name : Upload Artifacts
489+ if : success() && steps.create_zip.conclusion == 'success'
494490 uses : actions/upload-artifact@v4
495491 with :
496492 name : kernel-${{ env.CONFIG }}
0 commit comments