Skip to content

Commit 272b96e

Browse files
committed
Extract Kernel Version from source and update Release Notes
1 parent db3490f commit 272b96e

File tree

2 files changed

+64
-5
lines changed

2 files changed

+64
-5
lines changed

.github/actions/action.yml

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ runs:
405405
make -j$(nproc --all) O=out $MAKE_ARGS || exit 1
406406
407407
- name: Create Kernel ZIP
408+
id: create_zip
408409
shell: bash
409410
run: |
410411
CONFIG_DIR="$GITHUB_WORKSPACE/${{ env.CONFIG }}"
@@ -421,8 +422,66 @@ runs:
421422
echo "Creating zip file $ZIP_NAME in $ARTIFACTS_DIR..."
422423
zip -r "$ARTIFACTS_DIR/$ZIP_NAME" ./*
423424
425+
- name: Save Build Metadata
426+
shell: bash
427+
if: success() && steps.create_zip.conclusion == 'success'
428+
id: save_metadata
429+
run: |
430+
cd "$GITHUB_WORKSPACE"
431+
if [ -z "$(ls *.zip 2>/dev/null)" ]; then
432+
echo "No kernel zip found! Artifact upload might be fake."
433+
exit 1
434+
fi
435+
436+
cd "$CONFIG/kernel_platform/common"
437+
CONFIG_FILES=("build.config.common" "build.config.constants")
438+
BRANCH_LINE=""
439+
440+
for file in "${CONFIG_FILES[@]}"; do
441+
if [ -f "$file" ]; then
442+
line=$(grep '^[[:space:]]*BRANCH=' "$file" | head -n1 || true)
443+
if [ -n "$line" ]; then
444+
BRANCH_LINE="$line"
445+
echo "Found BRANCH in: $file"
446+
break # Found it — exit loop
447+
else
448+
echo "File exists but no BRANCH= found: $file"
449+
fi
450+
else
451+
echo "File not found: $file"
452+
fi
453+
done
454+
455+
if [ -z "$BRANCH_LINE" ]; then
456+
echo "Error: No BRANCH= found in any of: ${CONFIG_FILES[*]}"
457+
exit 1
458+
fi
459+
460+
BRANCH_VALUE="${BRANCH_LINE#*=}"
461+
ANDROID_VERSION="${BRANCH_VALUE%-*}"
462+
463+
if [ -z "$ANDROID_VERSION" ]; then
464+
echo "Error: Could not extract 'androidXX' from BRANCH='$BRANCH_VALUE'"
465+
exit 1
466+
fi
467+
468+
# Extract values using grep and awk
469+
VERSION=$(grep '^VERSION *=' Makefile | awk '{print $3}')
470+
PATCHLEVEL=$(grep '^PATCHLEVEL *=' Makefile | awk '{print $3}')
471+
SUBLEVEL=$(grep '^SUBLEVEL *=' Makefile | awk '{print $3}')
472+
FULL_VERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL"
473+
474+
echo "Kernel Version: $ANDROID_VERSION-$FULL_VERSION"
475+
476+
CONFIG_DIR="$GITHUB_WORKSPACE/${{ env.CONFIG }}"
477+
ARTIFACTS_DIR="$CONFIG_DIR/artifacts"
478+
cd "$ARTIFACTS_DIR"
479+
echo "$ANDROID_VERSION-$FULL_VERSION" > ${{ inputs.model }}.txt
480+
424481
- name: Upload Artifacts
425482
uses: actions/upload-artifact@v4
426483
with:
427484
name: kernel-${{ env.CONFIG }}
428-
path: ${{ env.CONFIG }}/artifacts/*.zip
485+
path: |
486+
${{ env.CONFIG }}/artifacts/*.zip
487+
${{ env.CONFIG }}/artifacts/${{ inputs.model }}.txt

.github/workflows/build-kernel-release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,11 +348,11 @@ jobs:
348348
EOF
349349
350350
# Generate table rows
351-
for file in $(find downloaded-artifacts -name "*.zip" -type f | sort); do
351+
for file in $(find downloaded-artifacts -name "*.txt" -type f | sort); do
352352
if [ -f "$file" ]; then
353-
model=$(basename "$(dirname "$file")" | sed 's/-kernel$//')
354-
kernel_version=$(grep -oP 'android\d+-\d+\.\d+' "$file" || echo "${{ matrix.android_version }}-${{ matrix.kernel_version }}")
355-
printf "| %-12s | %-16s |\n" "$model" "$kernel_version" >> release_notes.md
353+
model=$(basename "$file" .txt)
354+
version=$(cat "$file")
355+
printf "| %-12s | %-16s |\n" "$model" "$version" >> release_notes.md
356356
fi
357357
done
358358

0 commit comments

Comments
 (0)