This repository has been archived by the owner on Nov 18, 2024. It is now read-only.
Custom Build kernel #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Custom Build kernel | |
on: | |
watch: | |
types: [started] | |
workflow_dispatch: | |
inputs: | |
KERNEL_SOURCE_BRANCH: | |
description: 'Kernel Source Code' | |
required: true | |
default: 'https://github.com/HuaJI66/Xiaomi_Kernel_OpenSource@lineage-21' | |
DISABLE_CONFIG: | |
description: 'Disable Kernel Config(split with whitespace)' | |
required: true | |
default: 'CONFIG_LOCALVERSION_AUTO CONFIG_DEBUG_INFO CONFIG_MODVERSIONS CONFIG_CC_WERROR CONFIG_CRYPTO_DEV_QCOM_ICE' | |
ENABLE_CONFIG: | |
description: 'Enable Kernel Config(split with whitespace)' | |
required: true | |
default: 'CONFIG_LOCALVERSION="-perf" CONFIG_OVERLAY_FS CONFIG_BUILD_ARM64_DT_OVERLAY CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE' | |
RELEASE_REPO_TAG: | |
description: 'Release To Repository With Tag' | |
required: true | |
default: 'HuaJi66/Xiaomi_Kernel_OpenSource/lineage-21' | |
BUILD_ARGS: | |
description: 'Build Arga' | |
required: true | |
default: 'build_pad5p' | |
TOOLCHAIN: | |
description: 'Choice Toochain' | |
required: true | |
default: 'yuki' | |
type: choice | |
options: | |
- "nexus" | |
- "neutron" | |
- "nex14" | |
- "aosp" | |
- "zyc" | |
- "slim" | |
- "eva-gcc" | |
- "yuki" | |
- "llvm" | |
KERNELSU_TAG: | |
description: 'KernelSU TAG' | |
required: false | |
default: 'v0.9.5' | |
type: choice | |
options: | |
- 'v1.0.0' | |
- 'v0.9.5' | |
- 'v0.9.4' | |
- 'v0.9.3' | |
- 'v0.9.2' | |
- 'v0.9.1' | |
- 'v0.9.0' | |
jobs: | |
build: | |
name: Build Kernel by ${{ github.actor }} | |
runs-on: ubuntu-22.04 | |
if: github.event.repository.owner.id == github.event.sender.id | |
env: | |
CCACHE_COMPILERCHECK: "%compiler% -dumpmachine; %compiler% -dumpversion" | |
CCACHE_NOHASHDIR: "true" | |
CCACHE_HARDLINK: "true" | |
CI: "false" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Prepare Configuration | |
run: | | |
# Release | |
echo "PUBLISH_RELEASE_REPO_AUTHOR=$(echo ${{ inputs.RELEASE_REPO_TAG }} | awk -F '/' '{ print $1 }')" >> $GITHUB_ENV | |
echo "PUBLISH_RELEASE_REPO=$(echo ${{ inputs.RELEASE_REPO_TAG }} | awk -F '/' '{ print $2 }')" >> $GITHUB_ENV | |
echo "PUBLISH_RELEASE_VERSION=$(echo ${{ inputs.RELEASE_REPO_TAG }} | awk -F '/' '{ print $3 }')" >> $GITHUB_ENV | |
echo "SOURCE_BRANCH=$(echo ${{ inputs.KERNEL_SOURCE_BRANCH }} | awk -F '@' '{ print $2 }')" >> $GITHUB_ENV | |
if [ ! -z "${{ env.PUBLISH_RELEASE_REPO_AUTHOR }}" ] && [ ! -z "${{ env.PUBLISH_RELEASE_REPO }}" ] && [ ! -z "${{ env.PUBLISH_RELEASE_VERSION }}" ]; then | |
echo "PUBLISH_RELEASE=false" >> $GITHUB_ENV | |
else | |
echo "PUBLISH_RELEASE=true" >> $GITHUB_ENV | |
fi | |
if [ ! -d $GITHUB_WORKSPACE/.cache/ccache ];then | |
mkdir -p $GITHUB_WORKSPACE/.cache/ccache | |
fi | |
- name: Set swap | |
uses: pierotofy/set-swap-space@master | |
with: | |
swap-size-gb: 10 | |
- name: Setup Ccache | |
uses: actions/cache@v3 | |
with: | |
key: Ccache-${{ runner.os }}-build-kernel@${{ env.SOURCE_BRANCH }} | |
path: | | |
.cache/ccache | |
- name: Download kernel source | |
run: | | |
export GITHUB_TOKEN="${{ secrets.ACTION }}" | |
export OWNER=${{ github.actor }} | |
curl -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.raw" https://raw.githubusercontent.com/${{ github.actor }}/Build_Kernel_Action/enuma/shell/down_git.sh -o down_git.sh | |
chmod +x *.sh && bash down_git.sh "${{ inputs.KERNEL_SOURCE_BRANCH }}" | |
curl -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.raw" https://raw.githubusercontent.com/${{ github.actor }}/Build_Kernel_Action/enuma/build_custom.sh -o $GITHUB_WORKSPACE/android-kernel/build_custom.sh | |
curl -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.raw" https://raw.githubusercontent.com/${{ github.actor }}/Build_Kernel_Action/enuma/shell/build.sh -o $GITHUB_WORKSPACE/android-kernel/build.sh | |
chmod +x $GITHUB_WORKSPACE/android-kernel/*.sh | |
- name: Build Kernel On Docker | |
run: | | |
export GITHUB_TOKEN="${{ secrets.ACTION }}" | |
cd $GITHUB_WORKSPACE/android-kernel | |
docker run --name kb --privileged=true \ | |
-v $GITHUB_WORKSPACE/.cache/ccache:/root/.cache/ccache/ \ | |
-v $(pwd):/root/source \ | |
-v /etc/timezone:/etc/timezone \ | |
-e "OWNER=${{ github.actor }}" \ | |
-e "GITHUB_TOKEN=${{ secrets.ACTION }}" \ | |
-e "KBUILD_BUILD_HOST=docker_builder" \ | |
-e "KBUILD_BUILD_USER=$(echo ${{ github.actor }} | tr A-Z a-z)" \ | |
-e "KERNEL_TAG=${{ env.SOURCE_BRANCH }}" \ | |
-e "KERNEL_SOURCE='${{ env.KERNEL_SOURCE }}'" \ | |
-e "KERNEL_DIR=/root/source" \ | |
-e "OUT_DIR=out" \ | |
-e "TOOLCHAIN=${{ inputs.TOOLCHAIN }}" \ | |
-e "ENABLE_CONFIG='${{ inputs.ENABLE_CONFIG }}'" \ | |
-e "DISABLE_CONFIG='${{ inputs.DISABLE_CONFIG }}'" \ | |
$(echo ${{ github.actor }} | tr A-Z a-z)/kernel_builder:base bash -c "/root/source/build_custom.sh ${{ inputs.BUILD_ARGS }}" | |
if [ ! -f CHANGELOG.md ];then | |
echo -e "# Build Log\n- Commit: $(git log --oneline -1)\n- Build Date: $(date)\n- Linux Version: $(make kernelversion)\n- Complier: `cat complier.version`" > CHANGELOG.md | |
fi | |
- name: Upload Release | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.PUBLISH_RELEASE_VERSION }} | |
path: android-kernel/release/* | |
- name: Release Kernel | |
uses: softprops/action-gh-release@v2 | |
if: env.PUBLISH_RELEASE == 'true' | |
with: | |
repository: ${{ env.PUBLISH_RELEASE_REPO_AUTHOR }}/${{ env.PUBLISH_RELEASE_REPO }} | |
name: ${{ env.PUBLISH_RELEASE_VERSION }} Kernel For Xiaomi Pad 5 Pro Devices | |
tag_name: ${{ env.PUBLISH_RELEASE_VERSION }} | |
files: | | |
android-kernel/release/*.zip | |
android-kernel/release/Image* | |
android-kernel/release/dtb* | |
body_path: android-kernel/CHANGELOG.md | |
prerelease: false | |
make_latest: true | |
# note you'll typically need to create a personal access token | |
# with permissions to create releases in the other repo | |
# token: ${{secrets.ACTION}} | |
- name: Upload Ccache | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Ccache-${{ runner.os }}-build-kernel@${{ env.SOURCE_BRANCH }} | |
path: .cache/ccache |