Skip to content

Commit

Permalink
Only save gradle cache on asset build job
Browse files Browse the repository at this point in the history
  • Loading branch information
topjohnwu committed Aug 18, 2024
1 parent 5f27a62 commit 7c7cfd2
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
36 changes: 31 additions & 5 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
name: Magisk Setup
inputs:
is-asset-build:
required: false
default: false
runs:
using: "composite"
steps:
Expand Down Expand Up @@ -30,21 +34,43 @@ runs:
- name: Cache Gradle dependencies
uses: actions/cache@v4
if: is-asset-build
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: ${{ !is-asset-build }}
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: is-asset-build
with:
path: |
~/.gradle/caches/build-cache-*
key: gradle-build-cache-${{ github.sha }}
restore-keys: gradle-build-cache-

- name: Restore Gradle build cache
uses: actions/cache/restore@v4
if: ${{ !is-asset-build }}
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: Set up NDK
run: python build.py -v ndk
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7c7cfd2

Please sign in to comment.