Преглед на файлове

chore: reorganize kernel configuration files and update commit pins

- Deleted old kernel configuration files for Android 12, 13, 14, 15, and 16.
- Added new kernel configuration files for Android 12, 13, 14, 15, and 16 with updated kernel versions.
- Updated GitHub Actions workflow to reference new configuration file paths.
- Created a new workflow to fetch and update the latest commit pins for KernelSU and SUSFS.
- Added a new JSON file to track commit hashes for various kernel versions.
TheWildJames преди 4 месеца
родител
ревизия
3505669aeb

+ 4 - 1
.github/actions/kernelsu/action.yml

@@ -10,7 +10,10 @@ runs:
       run: |
         set -euo pipefail
 
-        curl -LSs "https://raw.githubusercontent.com/KernelSU-Next/KernelSU-Next/dev/kernel/setup.sh" | bash -s 293ca016cf7196c2e96403a929ea3f464fd3568b
+        COMMITS_JSON="${{ github.workspace }}/.github/config/commits.json"
+        KSU_SETUP_COMMIT=$(jq -er '.kernelsu.dev' "$COMMITS_JSON")
+
+        curl -LSs "https://raw.githubusercontent.com/KernelSU-Next/KernelSU-Next/dev/kernel/setup.sh" | bash -s "$KSU_SETUP_COMMIT"
         
         cd KernelSU-Next/kernel
         

+ 5 - 21
.github/actions/susfs/action.yml

@@ -20,33 +20,17 @@ runs:
     - name: Setup SUSFS Branch
       shell: bash
       run: |
+        set -euo pipefail
+
         SUSFS_BRANCH="gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}"
         SUSFS_REPO="https://gitlab.com/simonpunk/susfs4ksu.git"        
+        COMMITS_JSON="${{ github.workspace }}/.github/config/commits.json"
+
         echo "Preparing SUSFS for branch: $SUSFS_BRANCH"
         echo "Cloning latest from $SUSFS_BRANCH..."
         git clone "$SUSFS_REPO" -b "$SUSFS_BRANCH" susfs4ksu
 
-        if [ "${{ inputs.kernel_version }}" = "5.10" ] && [ "${{ inputs.android_version }}" = "android12" ]; then
-          SUSFS_COMMIT="e1681bc4d6fa90203a1fd86f26a8583baa4433dc"
-        fi
-        if [ "${{ inputs.kernel_version }}" = "5.10" ] && [ "${{ inputs.android_version }}" = "android13" ]; then
-          SUSFS_COMMIT="6a47d9a4717a4d72244f4ec7197a69596f029730"
-        fi
-        if [ "${{ inputs.kernel_version }}" = "5.15" ] && [ "${{ inputs.android_version }}" = "android13" ]; then
-          SUSFS_COMMIT="349ed52eea1be5c9590289a76a90d78710d4bba0"
-        fi
-        if [ "${{ inputs.kernel_version }}" = "5.15" ] && [ "${{ inputs.android_version }}" = "android14" ]; then
-          SUSFS_COMMIT="16a22b6a608b3f124c64f70829657871eee3af37"
-        fi
-        if [ "${{ inputs.kernel_version }}" = "6.1" ]; then
-          SUSFS_COMMIT="ef16cbce5c5195988b9b630de85466148cbbcdef"
-        fi
-        if [ "${{ inputs.kernel_version }}" = "6.6" ]; then
-          SUSFS_COMMIT="de8d8ca1478dd58afd3b7a119a0ce2d55d0080cf"
-        fi
-        if [ "${{ inputs.kernel_version }}" = "6.12" ]; then
-          SUSFS_COMMIT="fd03bb9c3cb4ee07b16806e0528e06486ab1be2b"
-        fi
+        SUSFS_COMMIT=$(jq -er --arg key "$SUSFS_BRANCH" '.susfs[$key]' "$COMMITS_JSON")
         cd ${{ github.workspace }}/susfs4ksu
         git checkout "$SUSFS_COMMIT"
 

+ 0 - 0
.github/kernel-config/a12-5.10.json → .github/config/android12-5.10.json


+ 0 - 0
.github/kernel-config/a13-5.10.json → .github/config/android13-5.10.json


+ 0 - 0
.github/kernel-config/a13-5.15.json → .github/config/android13-5.15.json


+ 0 - 0
.github/kernel-config/a14-5.15.json → .github/config/android14-5.15.json


+ 0 - 0
.github/kernel-config/a14-6.1.json → .github/config/android14-6.1.json


+ 0 - 0
.github/kernel-config/a15-6.6.json → .github/config/android15-6.6.json


+ 0 - 0
.github/kernel-config/a16-6.12.json → .github/config/android16-6.12.json


+ 14 - 0
.github/config/commits.json

@@ -0,0 +1,14 @@
+{
+  "kernelsu": {
+    "dev": "4c9737aed458843e920de95b0bcad56cf790663b"
+  },
+  "susfs": {
+    "gki-android12-5.10": "e1681bc4d6fa90203a1fd86f26a8583baa4433dc",
+    "gki-android13-5.10": "6a47d9a4717a4d72244f4ec7197a69596f029730",
+    "gki-android13-5.15": "349ed52eea1be5c9590289a76a90d78710d4bba0",
+    "gki-android14-5.15": "16a22b6a608b3f124c64f70829657871eee3af37",
+    "gki-android14-6.1": "ef16cbce5c5195988b9b630de85466148cbbcdef",
+    "gki-android15-6.6": "de8d8ca1478dd58afd3b7a119a0ce2d55d0080cf",
+    "gki-android16-6.12": "fd03bb9c3cb4ee07b16806e0528e06486ab1be2b"
+  }
+}

+ 119 - 0
.github/workflows/fetch-latest-commits.yml

@@ -0,0 +1,119 @@
+name: fetch-latest-commits
+
+permissions:
+  contents: write
+
+"on":
+  workflow_dispatch:
+    inputs:
+      apply_changes:
+        description: "Write updated commits to .github/config/commits.json and push"
+        type: boolean
+        default: false
+      target_branch:
+        description: "Branch to push changes to (only used when apply_changes=true)"
+        type: string
+        default: "main"
+
+jobs:
+  gather-commits:
+    runs-on: ubuntu-latest
+
+    steps:
+      - name: Checkout repository
+        uses: actions/checkout@v5
+        with:
+          ref: ${{ inputs.target_branch }}
+
+      - name: Gather latest commit pins
+        id: gather
+        shell: bash
+        run: |
+          set -euo pipefail
+
+          COMMITS_FILE=".github/config/commits.json"
+          KSU_REPO="https://github.com/KernelSU-Next/KernelSU-Next.git"
+          SUSFS_REPO="https://gitlab.com/simonpunk/susfs4ksu.git"
+
+          if [[ ! -f "$COMMITS_FILE" ]]; then
+            echo "Missing commits file: $COMMITS_FILE"
+            exit 1
+          fi
+
+          # Validate JSON early so we fail loudly on malformed edits.
+          jq -e . "$COMMITS_FILE" >/dev/null
+
+          KSU_BRANCH="dev"
+          KSU_LATEST=$(git ls-remote "$KSU_REPO" "refs/heads/$KSU_BRANCH" | awk '{print $1}')
+
+          if [[ -z "${KSU_LATEST:-}" ]]; then
+            echo "Failed to resolve KernelSU branch: $KSU_BRANCH"
+            exit 1
+          fi
+
+          TMP_FILE=$(mktemp)
+          jq --arg commit "$KSU_LATEST" '.kernelsu.dev = $commit' "$COMMITS_FILE" > "$TMP_FILE"
+          mv "$TMP_FILE" "$COMMITS_FILE"
+
+          echo "KernelSU dev -> $KSU_LATEST"
+
+          # Iterate current SUSFS keys (e.g. gki-android14-6.1) and fetch latest heads.
+          while IFS= read -r branch; do
+            [[ -n "$branch" ]] || continue
+
+            latest=$(git ls-remote "$SUSFS_REPO" "refs/heads/$branch" | awk '{print $1}')
+            if [[ -z "${latest:-}" ]]; then
+              echo "Warning: could not resolve SUSFS branch: $branch"
+              continue
+            fi
+
+            tmp=$(mktemp)
+            jq --arg branch "$branch" --arg commit "$latest" '.susfs[$branch] = $commit' "$COMMITS_FILE" > "$tmp"
+            mv "$tmp" "$COMMITS_FILE"
+
+            echo "SUSFS $branch -> $latest"
+          done < <(jq -r '.susfs | keys[]' "$COMMITS_FILE")
+
+          echo "diff_present=false" >> "$GITHUB_OUTPUT"
+          if ! git diff --quiet -- "$COMMITS_FILE"; then
+            echo "diff_present=true" >> "$GITHUB_OUTPUT"
+          fi
+
+      - name: Show changes
+        shell: bash
+        run: |
+          set -euo pipefail
+          if git diff --quiet -- .github/config/commits.json; then
+            echo "No updates found."
+          else
+            echo "Updated commit pins:"
+            git --no-pager diff -- .github/config/commits.json
+          fi
+
+      - name: Commit and push changes
+        if: inputs.apply_changes == true && steps.gather.outputs.diff_present == 'true'
+        shell: bash
+        run: |
+          set -euo pipefail
+
+          git config user.name "github-actions[bot]"
+          git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
+
+          git add .github/config/commits.json
+          git commit -m "chore(ci): refresh KernelSU and SUSFS commit pins"
+          git push origin "HEAD:${{ inputs.target_branch }}"
+
+      - name: Summary
+        if: always()
+        shell: bash
+        run: |
+          {
+            echo "## Commit Pin Refresh"
+            echo "- apply_changes: ${{ inputs.apply_changes }}"
+            echo "- target_branch: ${{ inputs.target_branch }}"
+            if git diff --quiet -- .github/config/commits.json; then
+              echo "- result: no changes"
+            else
+              echo "- result: commits file updated"
+            fi
+          } >> "$GITHUB_STEP_SUMMARY"

+ 7 - 7
.github/workflows/main.yml

@@ -63,7 +63,7 @@ jobs:
     if: ${{ inputs.kernel_build_version == 'All' || inputs.kernel_build_version == 'a12-5-10' }}
     uses: ./.github/workflows/prepare.yml
     with:
-      config_file: .github/kernel-config/a12-5.10.json
+      config_file: .github/config/android12-5.10.json
       feature_set: ${{ inputs.feature_set || 'FULL' }}
       variant: ${{ inputs.variant || 'Normal' }}
       use_repo: ${{ inputs.use_repo }}
@@ -73,7 +73,7 @@ jobs:
     if: ${{ inputs.kernel_build_version == 'All' || inputs.kernel_build_version == 'a13-5-10' }}
     uses: ./.github/workflows/prepare.yml
     with:
-      config_file: .github/kernel-config/a13-5.10.json
+      config_file: .github/config/android13-5.10.json
       feature_set: ${{ inputs.feature_set || 'FULL' }}
       variant: ${{ inputs.variant || 'Normal' }}
       use_repo: ${{ inputs.use_repo }}
@@ -83,7 +83,7 @@ jobs:
     if: ${{ inputs.kernel_build_version == 'All' || inputs.kernel_build_version == 'a13-5-15' }}
     uses: ./.github/workflows/prepare.yml
     with:
-      config_file: .github/kernel-config/a13-5.15.json
+      config_file: .github/config/android13-5.15.json
       feature_set: ${{ inputs.feature_set || 'FULL' }}
       variant: ${{ inputs.variant || 'Normal' }}
       use_repo: ${{ inputs.use_repo }}
@@ -93,7 +93,7 @@ jobs:
     if: ${{ inputs.kernel_build_version == 'All' || inputs.kernel_build_version == 'a14-5-15' }}
     uses: ./.github/workflows/prepare.yml
     with:
-      config_file: .github/kernel-config/a14-5.15.json
+      config_file: .github/config/android14-5.15.json
       feature_set: ${{ inputs.feature_set || 'FULL' }}
       variant: ${{ inputs.variant || 'Normal' }}
       use_repo: ${{ inputs.use_repo }}
@@ -103,7 +103,7 @@ jobs:
     if: ${{ inputs.kernel_build_version == 'All' || inputs.kernel_build_version == 'a14-6-1' }}
     uses: ./.github/workflows/prepare.yml
     with:
-      config_file: .github/kernel-config/a14-6.1.json
+      config_file: .github/config/android14-6.1.json
       feature_set: ${{ inputs.feature_set || 'FULL' }}
       variant: ${{ inputs.variant || 'Normal' }}
       use_repo: ${{ inputs.use_repo }}
@@ -113,7 +113,7 @@ jobs:
     if: ${{ inputs.kernel_build_version == 'All' || inputs.kernel_build_version == 'a15-6-6' }}
     uses: ./.github/workflows/prepare.yml
     with:
-      config_file: .github/kernel-config/a15-6.6.json
+      config_file: .github/config/android15-6.6.json
       feature_set: ${{ inputs.feature_set || 'FULL' }}
       variant: ${{ inputs.variant || 'Normal' }}
       use_repo: ${{ inputs.use_repo }}
@@ -123,7 +123,7 @@ jobs:
     if: ${{ inputs.kernel_build_version == 'All' || inputs.kernel_build_version == 'a16-6-12' }}
     uses: ./.github/workflows/prepare.yml
     with:
-      config_file: .github/kernel-config/a16-6.12.json
+      config_file: .github/config/android16-6.12.json
       feature_set: ${{ inputs.feature_set || 'FULL' }}
       variant: ${{ inputs.variant || 'Normal' }}
       use_repo: ${{ inputs.use_repo }}