Skip to content

Commit 1734bb9

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

File tree

2 files changed

+130
-30
lines changed

2 files changed

+130
-30
lines changed

.github/actions/action.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,74 @@ 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 "$CONFIG"
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 "kernel_platform/common"
454+
CONFIG_FILES=("build.config.common" "build.config.constants")
455+
BRANCH_LINE=""
456+
FOUND_FILE=""
457+
458+
for file in "${CONFIG_FILES[@]}"; do
459+
if [ -f "$file" ]; then
460+
# Use grep to find BRANCH= (ignoring lines that start with #)
461+
line=$(grep '^[[:space:]]*BRANCH=' "$file" | head -n1)
462+
if [ -n "$line" ]; then
463+
BRANCH_LINE="$line"
464+
FOUND_FILE="$file"
465+
echo "Found BRANCH in: $file"
466+
break
467+
fi
468+
else
469+
echo "File not found: $file" >&2
470+
fi
471+
done
472+
473+
if [ -z "$BRANCH_LINE" ]; then
474+
echo "Error: No BRANCH= found in any of: ${CONFIG_FILES[*]}"
475+
exit 1
476+
fi
477+
478+
BRANCH_VALUE=$(echo "$BRANCH_LINE" | sed -E 's/^[^B]*BRANCH=([\"\']?)([^\"\']*)([\"\']?).*$/\2/')
479+
480+
ANDROID_VERSION=$(echo "$BRANCH_VALUE" | grep -oE 'android[0-9]+' | head -n1)
481+
482+
if [ -z "$ANDROID_VERSION" ]; then
483+
echo "Error: Could not extract 'androidXX' from BRANCH='$BRANCH_VALUE'"
484+
exit 1
485+
fi
486+
487+
# Extract values using grep and awk
488+
VERSION=$(grep '^VERSION *=' Makefile | awk '{print $3}')
489+
PATCHLEVEL=$(grep '^PATCHLEVEL *=' Makefile | awk '{print $3}')
490+
SUBLEVEL=$(grep '^SUBLEVEL *=' Makefile | awk '{print $3}')
491+
FULL_VERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL"
492+
493+
echo "Kernel Version: $ANDROID_VERSION-$FULL_VERSION"
494+
495+
cd "$GITHUB_WORKSPACE"
496+
mkdir -p build-meta
497+
echo "$ANDROID_VERSION-$FULL_VERSION" > build-meta/${{ inputs.model }}.txt
498+
499+
- name: Upload Metadata
500+
if: success() && steps.save_metadata.conclusion == 'success'
501+
uses: actions/upload-artifact@v3
502+
with:
503+
name: build-metadata
504+
path: build-meta/
505+
if-no-files-found: ignore

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

Lines changed: 64 additions & 30 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+
# === 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

327-
- 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 }}
334-
env:
335-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
361+
- name: Create GitHub Release
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
368+
env:
369+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
336370

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

0 commit comments

Comments
 (0)