From 821a6c6954212f45ceee41ce9474e30a673b0a36 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Sun, 18 Aug 2024 21:42:28 -0700 Subject: [PATCH] Only save gradle cache on asset build job --- .github/actions/setup/action.yml | 36 +++++++++++++++++++++++++++----- .github/workflows/build.yml | 2 ++ 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index baf568d92..09abb4ecb 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -1,4 +1,8 @@ name: Magisk Setup +inputs: + is-asset-build: + required: false + default: false runs: using: "composite" steps: @@ -30,21 +34,43 @@ runs: - name: Cache Gradle dependencies uses: actions/cache@v4 + if: inputs.is-asset-build == 'true' with: path: | ~/.gradle/caches ~/.gradle/wrapper !~/.gradle/caches/build-cache-* - key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/**') }} - restore-keys: ${{ runner.os }}-gradle- + key: gradle-cache-${{ hashFiles('gradle/**') }} + restore-keys: gradle-cache- - - name: Cache build cache + - name: Restore Gradle dependencies + uses: actions/cache/restore@v4 + if: inputs.is-asset-build == 'false' + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + !~/.gradle/caches/build-cache-* + key: gradle-cache-${{ hashFiles('gradle/**') }} + restore-keys: gradle-cache- + + - name: Cache Gradle build cache uses: actions/cache@v4 + if: inputs.is-asset-build == 'true' with: path: | ~/.gradle/caches/build-cache-* - key: ${{ runner.os }}-build-cache-${{ github.sha }} - restore-keys: ${{ runner.os }}-build-cache- + key: gradle-build-cache-${{ github.sha }} + restore-keys: gradle-build-cache- + + - name: Restore Gradle build cache + uses: actions/cache/restore@v4 + if: inputs.is-asset-build == 'false' + with: + path: | + ~/.gradle/caches/build-cache-* + key: gradle-build-cache-${{ github.sha }} + restore-keys: gradle-build-cache- - name: Set up NDK run: python build.py -v ndk diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ba635ab21..5bffb12fb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,6 +31,8 @@ jobs: - name: Setup environment uses: ./.github/actions/setup + with: + is-asset-build: true - name: Build release run: ./build.py -vr all