build-kernel-release.yml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. name: Build and Release GKI Kernels
  2. permissions:
  3. contents: write # Allow writing to repository contents (for pushing tags)
  4. actions: write # Allows triggering actions
  5. on:
  6. workflow_dispatch:
  7. inputs:
  8. make_release:
  9. description: 'Do you want to create a release?'
  10. required: true
  11. type: boolean
  12. default: true
  13. kernelsu_variant:
  14. description: "Choose KernelSU"
  15. required: true
  16. type: choice
  17. options:
  18. - Official
  19. - Next
  20. - MKSU
  21. default: Next
  22. kernelsu_branch:
  23. description: "Choose ksu branch"
  24. required: true
  25. type: choice
  26. options:
  27. - Stable
  28. - Dev
  29. - Other
  30. default: Stable
  31. kernelsu_branch_other:
  32. description: "If 'Other' is selected, specify your custom branch"
  33. required: false
  34. type: string # This input is required if 'Other' is chosen
  35. jobs:
  36. build-kernel-a12-5-10:
  37. uses: ./.github/workflows/kernel-a12-5.10.yml
  38. secrets: inherit
  39. with:
  40. make_release: ${{ inputs.make_release }}
  41. kernelsu_variant: ${{ inputs.kernelsu_variant }}
  42. kernelsu_branch: ${{ inputs.kernelsu_branch }}
  43. kernelsu_branch_other: ${{ inputs.kernelsu_branch_other }}
  44. build-kernel-a13-5-10:
  45. uses: ./.github/workflows/kernel-a13-5.10.yml
  46. secrets: inherit
  47. with:
  48. make_release: ${{ inputs.make_release }}
  49. kernelsu_variant: ${{ inputs.kernelsu_variant }}
  50. kernelsu_branch: ${{ inputs.kernelsu_branch }}
  51. kernelsu_branch_other: ${{ inputs.kernelsu_branch_other }}
  52. build-kernel-a13-5-15:
  53. uses: ./.github/workflows/kernel-a13-5.15.yml
  54. secrets: inherit
  55. with:
  56. make_release: ${{ inputs.make_release }}
  57. kernelsu_variant: ${{ inputs.kernelsu_variant }}
  58. kernelsu_branch: ${{ inputs.kernelsu_branch }}
  59. kernelsu_branch_other: ${{ inputs.kernelsu_branch_other }}
  60. build-kernel-a14-5-15:
  61. uses: ./.github/workflows/kernel-a14-5.15.yml
  62. secrets: inherit
  63. with:
  64. make_release: ${{ inputs.make_release }}
  65. kernelsu_variant: ${{ inputs.kernelsu_variant }}
  66. kernelsu_branch: ${{ inputs.kernelsu_branch }}
  67. kernelsu_branch_other: ${{ inputs.kernelsu_branch_other }}
  68. build-kernel-a14-6-1:
  69. uses: ./.github/workflows/kernel-a14-6.1.yml
  70. secrets: inherit
  71. with:
  72. make_release: ${{ inputs.make_release }}
  73. kernelsu_variant: ${{ inputs.kernelsu_variant }}
  74. kernelsu_branch: ${{ inputs.kernelsu_branch }}
  75. kernelsu_branch_other: ${{ inputs.kernelsu_branch_other }}
  76. build-kernel-a15-6-6:
  77. uses: ./.github/workflows/kernel-a15-6.6.yml
  78. secrets: inherit
  79. with:
  80. make_release: ${{ inputs.make_release }}
  81. kernelsu_variant: ${{ inputs.kernelsu_variant }}
  82. kernelsu_branch: ${{ inputs.kernelsu_branch }}
  83. kernelsu_branch_other: ${{ inputs.kernelsu_branch_other }}
  84. trigger-release:
  85. runs-on: ubuntu-latest
  86. needs:
  87. - build-kernel-a12-5-10
  88. - build-kernel-a13-5-10
  89. - build-kernel-a13-5-15
  90. - build-kernel-a14-5-15
  91. - build-kernel-a14-6-1
  92. - build-kernel-a15-6-6
  93. if: ${{ inputs.make_release }}
  94. env:
  95. REPO_OWNER: WildPlusKernel
  96. REPO_NAME: GKI_KernelSU_SUSFS
  97. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  98. RELEASE_NAME: "*TEST BUILD* GKI Kernels With KernelSU-${{ inputs.kernelsu_variant }} ${{ inputs.kernelsu_branch }} & SUSFS v1.5.5 *TEST BUILD*"
  99. RELEASE_NOTES: |
  100. This release contains KernelSU-${{ inputs.kernelsu_variant }} ${{ inputs.kernelsu_branch }} and SUSFS v1.5.5
  101. Features:
  102. -> KernelSU-${{ inputs.kernelsu_variant }}-${{ inputs.kernelsu_branch }}
  103. -> SUSFS ඞ v1.5.5
  104. -> Manual Syscall Hooks for Better Hiding
  105. -> Magic Mount Support
  106. -> Simple Maphide for LineageOS Detections
  107. -> Futile Maphide for jit-zygote-cache Detections
  108. -> Wireguard Support
  109. -> BBR Support
  110. Notes:
  111. -> SUS SU Mode 2 will show as disabled or not compatble due to non-kprobe hooks and is not needed anymore!
  112. -> Kernel Flasher is broken with latest susfs, try https://github.com/libxzr/HorizonKernelFlasher!
  113. Module:
  114. -> https://github.com/sidex15/ksu_module_susfs
  115. steps:
  116. # Checkout the code
  117. - name: Checkout code
  118. uses: actions/checkout@v3
  119. - name: Determine the branch for KernelSU-${{ inputs.kernelsu_variant }}
  120. if: ${{ inputs.kernelsu_branch == 'Dev' || inputs.kernelsu_variant == 'MKSU' }}
  121. run: |
  122. # Determine the branch based on user input
  123. if [[ "${{ inputs.kernelsu_variant }}" == "Official" || "${{ inputs.kernelsu_variant }}" == "MKSU" ]]; then
  124. BRANCH="main"
  125. elif [[ "${{ inputs.kernelsu_variant }}" == "Next" ]]; then
  126. BRANCH="next"
  127. elif [[ "${{ inputs.kernelsu_branch }}" == "Other" && -n "${{ inputs.kernelsu_branch_other }}" ]]; then
  128. BRANCH="${{ inputs.kernelsu_branch_other }}"
  129. else
  130. echo "Error: Custom branch not provided for 'Other'" >&2
  131. exit 1
  132. fi
  133. # Store the selected branch in GITHUB_ENV
  134. echo "KSU_BRANCH=$BRANCH" >> $GITHUB_ENV
  135. - name: Get commit hash or tag and generate URL for KernelSU-${{ inputs.kernelsu_variant }}
  136. run: |
  137. if [ "${{ inputs.kernelsu_variant }}" == "Official" ]; then
  138. echo "This is the Official variant"
  139. REPO_URL="https://github.com/tiann/KernelSU.git"
  140. REPO_URL2="tiann/KernelSU"
  141. elif [ "${{ inputs.kernelsu_variant }}" == "Next" ]; then
  142. echo "This is the Next variant"
  143. REPO_URL="https://github.com/KernelSU-Next/KernelSU-Next.git"
  144. REPO_URL2="KernelSU-Next/KernelSU-Next"
  145. elif [ "${{ inputs.kernelsu_variant }}" == "MKSU" ]; then
  146. echo "This is the MKSU variant"
  147. REPO_URL="https://github.com/5ec1cff/KernelSU.git"
  148. REPO_URL2="5ec1cff/KernelSU"
  149. else
  150. echo "Unknown variant"
  151. fi
  152. if [[ "${{ inputs.kernelsu_branch }}" == "Stable" && "${{ inputs.kernelsu_variant }}" != "MKSU" ]]; then
  153. # Fetch the latest tag
  154. TAG=$(git ls-remote --tags --sort=-v:refname $REPO_URL | grep -o 'refs/tags/.*' | cut -d'/' -f3 | head -n1)
  155. if [[ -z "$TAG" ]]; then
  156. echo "Error: Could not fetch latest tag for Stable" >&2
  157. exit 1
  158. fi
  159. KSU_REF=$TAG
  160. KSU_URL="https://github.com/$REPO_URL2/releases/tag/$TAG"
  161. elif [[ "${{ inputs.kernelsu_branch }}" == "Dev" || "${{ inputs.kernelsu_variant }}" == "MKSU" ]]; then
  162. # Fetch the latest commit from "next" branch
  163. COMMIT_HASH=$(git ls-remote $REPO_URL refs/heads/$KSU_BRANCH | awk '{ print $1 }')
  164. if [[ -z "$COMMIT_HASH" ]]; then
  165. echo "Error: Could not fetch latest commit for Dev" >&2
  166. exit 1
  167. fi
  168. KSU_REF=$COMMIT_HASH
  169. KSU_URL="https://github.com/$REPO_URL2/commit/$COMMIT_HASH"
  170. else
  171. # Fetch the specific tag
  172. TAG=${{ inputs.kernelsu_branch_other }}
  173. if git ls-remote --tags $REPO_URL | grep -q "refs/tags/$TAG"; then
  174. KSU_REF=$TAG
  175. KSU_URL="https://github.com/$REPO_URL2/releases/tag/$TAG"
  176. else
  177. echo "Error: Specified tag '$TAG' not found in KernelSU-Next" >&2
  178. exit 1
  179. fi
  180. fi
  181. # Echo the values to GitHub environment for later use
  182. echo "KSU_REF=$KSU_REF" >> $GITHUB_ENV
  183. echo "KSU_URL=$KSU_URL" >> $GITHUB_ENV
  184. echo "KernelSU Reference: $KSU_REF"
  185. echo "KernelSU URL: $KSU_URL"
  186. - name: Get commit hashes and generate commit URLs
  187. run: |
  188. GITLAB_OWNER="simonpunk"
  189. GITLAB_REPO="susfs4ksu"
  190. declare -A BRANCH_MAP=(
  191. ["gki_android12_5_10"]="gki-android12-5.10"
  192. ["gki_android13_5_10"]="gki-android13-5.10"
  193. ["gki_android13_5_15"]="gki-android13-5.15"
  194. ["gki_android14_5_15"]="gki-android14-5.15"
  195. ["gki_android14_6_1"]="gki-android14-6.1"
  196. )
  197. for var_name in "${!BRANCH_MAP[@]}"; do
  198. branch_name="${BRANCH_MAP[$var_name]}"
  199. COMMIT_HASH=$(git ls-remote https://gitlab.com/$GITLAB_OWNER/$GITLAB_REPO.git refs/heads/$branch_name | awk '{ print $1 }')
  200. if [[ -n "$COMMIT_HASH" ]]; then
  201. COMMIT_URL="https://gitlab.com/$GITLAB_OWNER/$GITLAB_REPO/-/commit/$COMMIT_HASH"
  202. echo "$branch_name Commit: $COMMIT_HASH"
  203. echo "$branch_name Commit URL: $COMMIT_URL"
  204. # Store commit hash and commit URL in GitHub environment
  205. echo "COMMIT_HASH_${var_name}=$COMMIT_HASH" >> "$GITHUB_ENV"
  206. echo "COMMIT_URL_${var_name}=$COMMIT_URL" >> "$GITHUB_ENV"
  207. fi
  208. done
  209. - name: Append Commit Hashes & Links to `RELEASE_NOTES` & Append KernelSU-Next Reference to `RELEASE_NOTES`
  210. run: |
  211. if [ "${{ inputs.kernelsu_variant }}" == "Official" ]; then
  212. echo "This is the Official variant"
  213. echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
  214. echo "$RELEASE_NOTES" >> $GITHUB_ENV
  215. echo "Official Manager:" >> $GITHUB_ENV
  216. echo "-> https://github.com/tiann/KernelSU" >> $GITHUB_ENV
  217. echo "EOF" >> $GITHUB_ENV
  218. elif [ "${{ inputs.kernelsu_variant }}" == "Next" ]; then
  219. echo "This is the Next variant"
  220. echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
  221. echo "$RELEASE_NOTES" >> $GITHUB_ENV
  222. echo "Next Manager:" >> $GITHUB_ENV
  223. echo "-> https://github.com/KernelSU-Next/KernelSU-Next" >> $GITHUB_ENV
  224. echo "EOF" >> $GITHUB_ENV
  225. elif [ "${{ inputs.kernelsu_variant }}" == "MKSU" ]; then
  226. echo "This is the MKSU variant"
  227. echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
  228. echo "$RELEASE_NOTES" >> $GITHUB_ENV
  229. echo "MKSU Manager:" >> $GITHUB_ENV
  230. echo "-> https://github.com/5ec1cff/KernelSU" >> $GITHUB_ENV
  231. echo "EOF" >> $GITHUB_ENV
  232. else
  233. echo "Unknown variant"
  234. fi
  235. - name: Append Commit Hashes & Links to `RELEASE_NOTES` & Append KernelSU-Next Reference to `RELEASE_NOTES`
  236. run: |
  237. echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
  238. echo "$RELEASE_NOTES" >> $GITHUB_ENV
  239. echo "" >> $GITHUB_ENV
  240. echo "LTO: thin" >> $GITHUB_ENV
  241. echo "" >> $GITHUB_ENV
  242. echo "Commit Hashes and Links:" >> $GITHUB_ENV
  243. echo "KernelSU:" >> $GITHUB_ENV
  244. echo "${{ inputs.kernelsu_variant }}-${{ inputs.kernelsu_branch }}: [$KSU_REF]($KSU_URL)" >> $GITHUB_ENV
  245. echo "SUSFS4KSU:" >> $GITHUB_ENV
  246. echo "gki-android12-5.10: [$COMMIT_HASH_gki_android12_5_10]($COMMIT_URL_gki_android12_5_10)" >> $GITHUB_ENV
  247. echo "gki-android13-5.10: [$COMMIT_HASH_gki_android13_5_10]($COMMIT_URL_gki_android13_5_10)" >> $GITHUB_ENV
  248. echo "gki-android13-5.15: [$COMMIT_HASH_gki_android13_5_15]($COMMIT_URL_gki_android13_5_15)" >> $GITHUB_ENV
  249. echo "gki-android14-5.15: [$COMMIT_HASH_gki_android14_5_15]($COMMIT_URL_gki_android14_5_15)" >> $GITHUB_ENV
  250. echo "gki-android14-6.1: [$COMMIT_HASH_gki_android14_6_1]($COMMIT_URL_gki_android14_6_1)" >> $GITHUB_ENV
  251. echo "" >> $GITHUB_ENV
  252. echo "EOF" >> $GITHUB_ENV
  253. # Get the Latest Tag from GitHub
  254. - name: Generate and Create New Tag
  255. env:
  256. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  257. run: |
  258. # Fetch the latest tag from GitHub (this is the latest tag based on the GitHub API)
  259. LATEST_TAG=$(gh api repos/$REPO_OWNER/$REPO_NAME/tags --jq '.[0].name')
  260. if [ -z "$LATEST_TAG" ]; then
  261. LATEST_TAG="v1.5.5-r0"
  262. fi
  263. NEW_TAG=$(echo "$LATEST_TAG" | awk -F'-r' '{suffix=$2; if (!suffix) suffix=0; suffix++; printf "%s-r%d", $1, suffix}')
  264. # Output the new tag to be used
  265. echo "New tag: $NEW_TAG"
  266. # Set the new tag as an environment variable to be used in later steps
  267. echo "NEW_TAG=${NEW_TAG}" >> $GITHUB_ENV
  268. # Create the tag in the repository
  269. git tag $NEW_TAG
  270. git push --tags
  271. # Download Artifacts for A12 (Only if A12 Build is successful or input is true or empty)
  272. - name: Download Artifacts
  273. uses: actions/download-artifact@v4
  274. with:
  275. path: ./downloaded-artifacts
  276. # Create GitHub Release and upload files if make_release is true
  277. - name: Create GitHub Release
  278. uses: actions/create-release@v1
  279. with:
  280. tag_name: ${{ env.NEW_TAG }} # Use the generated tag for the release
  281. prerelease: true # Mark the release as a pre-release
  282. release_name: ${{ env.RELEASE_NAME }} # Pass the RELEASE_NAME to the action
  283. body: ${{ env.RELEASE_NOTES }} # Pass the RELEASE_NOTES to the action
  284. - name: Upload Release Assets Dynamically
  285. run: |
  286. # Loop through all files in the downloaded-artifacts directory
  287. for file in ./downloaded-artifacts/kernel-*/*; do
  288. # Skip directories
  289. if [ -d "$file" ]; then
  290. continue
  291. fi
  292. # Upload the file to the GitHub release
  293. echo "Uploading $file..."
  294. gh release upload ${{ env.NEW_TAG }} "$file"
  295. done
  296. # Display Files Uploaded
  297. - name: Display Files Uploaded
  298. run: |
  299. echo "GitHub release created with the following files:"
  300. ls ./downloaded-artifacts/**/*
  301. - name: send telegram message on push
  302. env:
  303. TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
  304. TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
  305. TELEGRAM_MESSAGE_THREAD_ID: ${{ secrets.TELEGRAM_MESSAGE_THREAD_ID }}
  306. run: |
  307. curl -X POST "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage" \
  308. -d "chat_id=$TELEGRAM_CHAT_ID" \
  309. -d "message_thread_id=$TELEGRAM_MESSAGE_THREAD_ID" \
  310. -d "text=Latest release:
  311. https://github.com/WildPlusKernel/GKI_KernelSU_SUSFS/releases/tag/${{ env.NEW_TAG }}
  312. ${{ env.RELEASE_NOTES }}"