James McConnell 1 год назад
Родитель
Сommit
a5fc22244d
1 измененных файлов с 24 добавлено и 5 удалено
  1. 24 5
      .github/workflows/gki-kernel.yml

+ 24 - 5
.github/workflows/gki-kernel.yml

@@ -65,6 +65,10 @@ jobs:
 
           echo "CONFIG set to: $CONFIG"
 
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    steps:
       - name: Set up cache for toolchain
         uses: actions/cache@v4
         id: cache-toolchain
@@ -74,13 +78,19 @@ jobs:
             mkbootimg
           key: toolchain-${{ runner.os }}-v1
 
-      - name: Restore prebuilt toolchain from cache (if available)
-        if: steps.cache-toolchain.outputs.cache-hit == 'true'
+      - name: Check if toolchain is already cached or exists
+        id: check-toolchain
         run: |
-          echo "Toolchain restored from cache."
+          if [ -d "./kernel-build-tools" ] && [ -d "./mkbootimg" ]; then
+            echo "Toolchain already exists. Skipping download."
+            echo "cache-hit=true" >> $GITHUB_ENV
+          else
+            echo "Toolchain not found. Will download."
+            echo "cache-hit=false" >> $GITHUB_ENV
+          fi
 
-      - name: Use prebuilt toolchain (if cache is missing, download)
-        if: steps.cache-toolchain.outputs.cache-hit != 'true'
+      - name: Download prebuilt toolchain (if cache is missing)
+        if: env.cache-hit == 'false'
         run: |
           AOSP_MIRROR=https://android.googlesource.com
           BRANCH=main-kernel-build-2024
@@ -94,6 +104,15 @@ jobs:
 
           rm -rf $TEMP_DIR
 
+      - name: Save toolchain to cache
+        if: env.cache-hit == 'false'
+        uses: actions/cache@v4
+        with:
+          path: |
+            kernel-build-tools
+            mkbootimg
+          key: toolchain-${{ runner.os }}-v1
+
       - name: Set environment variables
         run: |
           echo "AVBTOOL=$GITHUB_WORKSPACE/kernel-build-tools/linux-x86/bin/avbtool" >> $GITHUB_ENV