Skip to content

Commit e9a315e

Browse files
committed
Test Kernel version extract
1 parent 51f837e commit e9a315e

File tree

2 files changed

+125
-28
lines changed

2 files changed

+125
-28
lines changed

.github/actions/action.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,71 @@ runs:
432432
zip -r "../$ZIP_NAME" ./*
433433
434434
- name: Upload Build Artifacts
435+
id: upload_ak3_zip
435436
uses: actions/upload-artifact@v4
436437
with:
437438
name: kernel-${{ env.CONFIG }}
438439
path: |
439440
*.zip
441+
442+
- name: Save Build Metadata
443+
shell: bash
444+
if: success() && steps.upload_ak3_zip.conclusion == 'success'
445+
id: save_metadata
446+
run: |
447+
cd "$GITHUB_WORKSPACE"
448+
if [ -z "$(ls *.zip 2>/dev/null)" ]; then
449+
echo "No kernel zip found! Artifact upload might be fake."
450+
exit 1
451+
fi
452+
453+
cd "$CONFIG/kernel_platform/common"
454+
CONFIG_FILES=("build.config.common" "build.config.constants")
455+
BRANCH_LINE=""
456+
457+
for file in "${CONFIG_FILES[@]}"; do
458+
if [ -f "$file" ]; then
459+
# Use grep to find BRANCH= (ignoring lines that start with #)
460+
line=$(grep '^[[:space:]]*BRANCH=' "$file" | head -n1)
461+
if [ -n "$line" ]; then
462+
BRANCH_LINE="$line"
463+
echo "Found BRANCH in: $file"
464+
break
465+
fi
466+
else
467+
echo "File not found: $file" >&2
468+
fi
469+
done
470+
471+
if [ -z "$BRANCH_LINE" ]; then
472+
echo "Error: No BRANCH= found in any of: ${CONFIG_FILES[*]}"
473+
exit 1
474+
fi
475+
476+
BRANCH_VALUE="${BRANCH_LINE#*=}"
477+
ANDROID_VERSION="${BRANCH_VALUE%-*}"
478+
479+
if [ -z "$ANDROID_VERSION" ]; then
480+
echo "Error: Could not extract 'androidXX' from BRANCH='$BRANCH_VALUE'"
481+
exit 1
482+
fi
483+
484+
# Extract values using grep and awk
485+
VERSION=$(grep '^VERSION *=' Makefile | awk '{print $3}')
486+
PATCHLEVEL=$(grep '^PATCHLEVEL *=' Makefile | awk '{print $3}')
487+
SUBLEVEL=$(grep '^SUBLEVEL *=' Makefile | awk '{print $3}')
488+
FULL_VERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL"
489+
490+
echo "Kernel Version: $ANDROID_VERSION-$FULL_VERSION"
491+
492+
cd "$GITHUB_WORKSPACE"
493+
mkdir -p build-meta
494+
echo "$ANDROID_VERSION-$FULL_VERSION" > build-meta/${{ inputs.model }}.txt
495+
496+
- name: Upload Metadata
497+
if: success() && steps.save_metadata.conclusion == 'success'
498+
uses: actions/upload-artifact@v4
499+
with:
500+
name: build-metadata
501+
path: build-meta/
502+
if-no-files-found: ignore

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

Lines changed: 62 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -278,27 +278,6 @@ jobs:
278278
REPO_NAME: ${{ github.event.repository.name }}
279279
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
280280
RELEASE_NAME: "*TEST BUILD* OnePlus Kernels With KernelSU Next & SUSFS v1.5.9 *TEST BUILD*"
281-
RELEASE_NOTES: |
282-
This release contains KernelSU Next and SUSFS v1.5.9
283-
284-
Module:
285-
-> https://github.com/sidex15/ksu_module_susfs
286-
287-
Non-Official Managers:
288-
-> https://github.com/KernelSU-Next/KernelSU-Next
289-
290-
Features:
291-
[+] KernelSU-Next
292-
[+] SUSFS v1.5.9
293-
[+] Wireguard Support
294-
[+] Maphide LineageOS Detections
295-
[+] Futile Maphide for jit-zygote-cache Detections
296-
[+] Magic Mount Support
297-
[+] Ptrace message leak fix for kernels < 5.16
298-
[+] Manual Hooks [scope_min_manual_hooks_v1.4]
299-
[+] CONFIG_TMPFS_XATTR Support [Mountify Support]
300-
[+] BBR v1 Support.
301-
[+] HMBIRD scx support for OnePlus 13 & OnePlus Ace 5 Pro.
302281

303282
steps:
304283
- name: Checkout code
@@ -319,20 +298,75 @@ jobs:
319298
git tag $NEW_TAG
320299
git push origin $NEW_TAG
321300
301+
- name: Download Build Metadata
302+
uses: actions/download-artifact@v4
303+
with:
304+
name: build-metadata
305+
path: ./build-meta
306+
307+
- name: Generate Device List and Final Release Notes
308+
id: generate-notes
309+
run: |
310+
echo "=== Start building the release notes ==="
311+
cat << EOF > release_notes.md
312+
This release contains KernelSU Next and SUSFS v1.5.9
313+
314+
Module:
315+
-> https://github.com/sidex15/ksu_module_susfs
316+
317+
Non-Official Managers:
318+
-> https://github.com/KernelSU-Next/KernelSU-Next
319+
320+
### Built Devices
321+
322+
| Model | Kernel Version |
323+
|-------|----------------|
324+
EOF
325+
326+
# === Generate table rows ===
327+
while IFS= read -r file; do
328+
if [ -f "$file" ]; then
329+
model=$(basename "$file" .txt)
330+
version=$(cat "$file")
331+
printf "| %-7s | %-16s |\n" "$model" "$version" >> release_notes.md
332+
fi
333+
done < <(find build-meta -name "*.txt" -type f | sort)
334+
335+
# === Add features and finalize ===
336+
cat << 'EOF' >> release_notes.md
337+
338+
### Features
339+
- [+] KernelSU-Next
340+
- [+] SUSFS v1.5.9
341+
- [+] Wireguard Support
342+
- [+] Maphide LineageOS Detections
343+
- [+] Futile Maphide for jit-zygote-cache Detections
344+
- [+] Magic Mount Support
345+
- [+] Ptrace message leak fix for kernels < 5.16
346+
- [+] Manual Hooks [scope_min_manual_hooks_v1.4]
347+
- [+] CONFIG_TMPFS_XATTR Support [Mountify Support]
348+
- [+] BBR v1 Support.
349+
- [+] HMBIRD scx support for OnePlus 13 & OnePlus Ace 5 Pro.
350+
EOF
351+
352+
# === Output for debugging ===
353+
echo "--- Final Release Notes ---"
354+
cat release_notes.md
355+
322356
- name: Download Artifacts
323357
uses: actions/download-artifact@v4
324358
with:
325359
path: ./downloaded-artifacts
326360

327361
- name: Create GitHub Release
328-
uses: actions/create-release@v1
329-
with:
330-
tag_name: ${{ env.NEW_TAG }}
331-
prerelease: true
332-
release_name: ${{ env.RELEASE_NAME }}
333-
body: ${{ env.RELEASE_NOTES }}
362+
run: |
363+
gh release create "${{ env.NEW_TAG }}" \
364+
--repo "${{ env.REPO_OWNER }}/${{ env.REPO_NAME }}" \
365+
--title "${{ env.RELEASE_NAME }}" \
366+
--notes-file release_notes.md \
367+
--prerelease
334368
env:
335-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
369+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
336370

337371
- name: Upload Release Assets Dynamically
338372
run: |

0 commit comments

Comments
 (0)