Skip to content

Build and Release OnePlus Kernels #533

Build and Release OnePlus Kernels

Build and Release OnePlus Kernels #533

name: Build and Release OnePlus Kernels
permissions:
contents: write
actions: write
on:
workflow_dispatch:
inputs:
make_release:
description: 'Do you want to create a release?'
required: true
type: boolean
default: false
op_model:
description: 'Select the OnePlus kernels to build'
required: true
type: choice
options:
- OP13-CPH
- OP13-PJZ
- OP13r
- OP13S
- OP13T
- OP12
- OP12r
- OP11
- OP11u
- OP11r
- OP10pro
- OP10t
- OP-Nord-5
- OP-NORD-4
- OP-NORD-4-CE
- OP-NORD-CE4-LITE
- OP-ACE-5-PRO
- OP-ACE-5
- OP-ACE-3-PRO
- OP-ACE-3V
- OP-ACE-2-PRO
- OP-ACE-2
- OP-OPEN
- OP-PAD-3
- OP-PAD-2-PRO
- OP-PAD-2
- OP-PAD-PRO
default: OP11
ksun_branch:
description: 'Enter KernelSU Next Branch or commit hash (blank for stable tag)'
required: true
type: string
default: next
optimize_level:
description: "Compiler optimization level"
required: true
type: choice
options: [O2, O3]
default: O2
android12-5_10_susfs_branch_or_commit:
description: 'Enter SusFS Branch or commit hash for android12-5.10'
type: string
default: ''
android13-5_10_susfs_branch_or_commit:
description: 'Enter SusFS Branch or commit hash for android13-5.10'
type: string
default: ''
android13-5_15_susfs_branch_or_commit:
description: 'Enter SusFS Branch or commit hash for android13-5.15'
type: string
default: ''
android14-5_15_susfs_branch_or_commit:
description: 'Enter SusFS Branch or commit hash for android14-5.15'
type: string
default: ''
android14-6_1_susfs_branch_or_commit:
description: 'Enter SusFS Branch or commit hash for android14-6.1'
type: string
default: ''
android15-6_6_susfs_branch_or_commit:
description: 'Enter SusFS Branch or commit hash for android15-6.6'
type: string
default: ''
jobs:
set-op-model:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout Code (to access configs/)
uses: actions/checkout@v4
with:
sparse-checkout: |
configs/
sparse-checkout-cone-mode: false
- name: Setup OnePlus Model
id: set-matrix
shell: bash
run: |
set -euo pipefail
declare -a models=()
while IFS= read -r -d '' file; do
model=$(basename "$file" .json)
models+=("$model")
done < <(find configs/ -name "*.json" -print0)
if [ ${#models[@]} -eq 0 ]; then
echo "Error: No config files found in configs/ directory!"
exit 1
fi
echo "[" > matrix.json
for i in "${!models[@]}"; do
model="${models[$i]}"
file="configs/$model.json"
if [ -f "$file" ]; then
jq -r '.' "$file" >> matrix.json
if [ $((i+1)) -lt ${#models[@]} ]; then
echo "," >> matrix.json
fi
fi
done
echo "]" >> matrix.json
input="${{ github.event.inputs.op_model }}"
jq_filter="map(select(.model == \"$input\"))"
filtered=$(jq -c "$jq_filter" matrix.json)
wrapped=$(jq -n --argjson items "$filtered" '{ include: $items }')
echo "matrix<<MATRIX_EOF" >> "$GITHUB_OUTPUT"
echo "$wrapped" >> "$GITHUB_OUTPUT"
echo "MATRIX_EOF" >> "$GITHUB_OUTPUT"
build:
name: build (${{ matrix.model }}, ${{ matrix.soc }}, ${{ matrix.branch }}, ${{ matrix.manifest }}, ${{ matrix.android_version }}, ${{ matrix.kernel_version }}, ${{ inputs.ksun_branch }})
needs: set-op-model
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.set-op-model.outputs.matrix) }}
steps:
- name: Resolve SUSFS branch from inputs
id: susfs
shell: bash
run: |
set -euo pipefail
key="${{ matrix.android_version }}-${{ matrix.kernel_version }}"
declare -A map=(
["android12-5.10"]="${{ inputs.android12-5_10_susfs_branch_or_commit }}"
["android13-5.10"]="${{ inputs.android13-5_10_susfs_branch_or_commit }}"
["android13-5.15"]="${{ inputs.android13-5_15_susfs_branch_or_commit }}"
["android14-5.15"]="${{ inputs.android14-5_15_susfs_branch_or_commit }}"
["android14-6.1"]="${{ inputs.android14-6_1_susfs_branch_or_commit }}"
["android15-6.6"]="${{ inputs.android15-6_6_susfs_branch_or_commit }}"
)
if [[ -z "${map[$key]+_exists}" ]]; then
echo "Unsupported combo (no mapping): $key" >&2
exit 1
fi
echo "susfs_branch=${map[$key]}" >> "$GITHUB_OUTPUT"
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Build Kernel
uses: WildKernels/OnePlus_KernelSU_SUSFS/.github/actions@main
with:
op_config_json: ${{ toJSON(matrix) }}
ksun_branch: ${{ inputs.ksun_branch }}
susfs_commit_hash_or_branch: ${{ steps.susfs.outputs.susfs_branch }}
optimize_level: ${{ inputs.optimize_level }}
trigger-release:
needs: [build]
runs-on: ubuntu-latest
if: ${{ inputs.make_release }}
env:
REPO_OWNER: ${{ github.repository_owner }}
REPO_NAME: ${{ github.event.repository.name }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_NAME: '*TEST BUILD* OnePlus Kernels With KernelSU Next & SUSFS v1.5.12 *TEST BUILD*'
RELEASE_NOTES: |
This release contains KernelSU Next and SUSFS v1.5.12
Module:
-> https://github.com/sidex15/ksu_module_susfs
Non-Official Managers:
-> https://github.com/KernelSU-Next/KernelSU-Next
Features:
[+] KernelSU-Next / WildKSU Manager Support
[+] SUSFS v1.5.12
[+] Wireguard Support
[+] Magic Mount Support
[+] Ptrace message leak fix for kernels < 5.16
[+] Manual Hooks [scope_min_manual_hooks_v1.4]
[+] CONFIG_TMPFS_XATTR Support [Mountify Support]
[+] BBR v1 Support.
[+] HMBIRD scx support for OnePlus 13 & OnePlus Ace 5 Pro.
[+] Baseband Guard Support (BBG).
[+] IP Set Support.
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Generate and Create New Tag
run: |
BASE_TAG="v1.5.12-r0"
LATEST_TAG=$(gh api repos/$REPO_OWNER/$REPO_NAME/tags --jq '.[0].name')
if [ -z "$LATEST_TAG" ]; then
LATEST_TAG="$BASE_TAG"
else
LATEST_TAG=$(printf "%s\n%s\n" "$LATEST_TAG" "$BASE_TAG" | sort -rV | head -n1)
fi
NEW_TAG=$(echo "$LATEST_TAG" | awk -F'-r' '{suffix=$2; if (!suffix) suffix=0; suffix++; printf "%s-r%d", $1, suffix}')
echo "New tag: $NEW_TAG"
echo "NEW_TAG=${NEW_TAG}" >> $GITHUB_ENV
git tag $NEW_TAG
git push origin $NEW_TAG
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: ./downloaded-artifacts
- name: Create GitHub Release
uses: actions/create-release@v1
with:
tag_name: ${{ env.NEW_TAG }}
prerelease: true
release_name: ${{ env.RELEASE_NAME }}
body: ${{ env.RELEASE_NOTES }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Release Assets Dynamically
run: |
for file in ./downloaded-artifacts/kernel-*/*; do
if [ -d "$file" ]; then
continue
fi
echo "Uploading $file..."
gh release upload ${{ env.NEW_TAG }} "$file"
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NEW_TAG: ${{ env.NEW_TAG }}
- name: Display Files Uploaded
run: |
echo "GitHub release created with the following files:"
ls ./downloaded-artifacts/**/*