Skip to content

Commit 78c0cc8

Browse files
chore:upgrade action cache
1 parent e53adc5 commit 78c0cc8

File tree

2 files changed

+32
-8
lines changed

2 files changed

+32
-8
lines changed

.github/workflows/build-android.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,24 @@ jobs:
3434

3535
- name: Get yarn cache directory path
3636
id: yarn-cache-dir-path
37-
run: echo "::set-output name=dir::$(yarn cache dir)"
37+
run: |
38+
if command -v yarn &> /dev/null; then
39+
CACHE_DIR=$(yarn config get cacheFolder 2>/dev/null || yarn cache dir 2>/dev/null || echo "")
40+
if [ -z "$CACHE_DIR" ]; then
41+
CACHE_DIR="$HOME/.yarn/cache"
42+
fi
43+
else
44+
CACHE_DIR="$HOME/.yarn/cache"
45+
fi
46+
echo "dir=$CACHE_DIR" >> $GITHUB_OUTPUT
3847
- name: Restore node_modules from cache
39-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684
48+
uses: actions/cache@v5
4049
id: yarn-cache
4150
with:
42-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
51+
path: |
52+
${{ steps.yarn-cache-dir-path.outputs.dir }}
53+
node_modules
54+
example/node_modules
4355
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
4456
restore-keys: |
4557
${{ runner.os }}-yarn-
@@ -49,7 +61,7 @@ jobs:
4961
run: yarn install --frozen-lockfile --cwd example
5062

5163
- name: Restore Gradle cache
52-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684
64+
uses: actions/cache@v5
5365
with:
5466
path: |
5567
~/.gradle/caches

.github/workflows/build-ios.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,24 @@ jobs:
3131
node-version: 18
3232
- name: Get yarn cache directory path
3333
id: yarn-cache-dir-path
34-
run: echo "::set-output name=dir::$(yarn cache dir)"
34+
run: |
35+
if command -v yarn &> /dev/null; then
36+
CACHE_DIR=$(yarn config get cacheFolder 2>/dev/null || yarn cache dir 2>/dev/null || echo "")
37+
if [ -z "$CACHE_DIR" ]; then
38+
CACHE_DIR="$HOME/.yarn/cache"
39+
fi
40+
else
41+
CACHE_DIR="$HOME/.yarn/cache"
42+
fi
43+
echo "dir=$CACHE_DIR" >> $GITHUB_OUTPUT
3544
- name: Restore node_modules from cache
36-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684
45+
uses: actions/cache@v5
3746
id: yarn-cache
3847
with:
39-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
48+
path: |
49+
${{ steps.yarn-cache-dir-path.outputs.dir }}
50+
node_modules
51+
example/node_modules
4052
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
4153
restore-keys: |
4254
${{ runner.os }}-yarn-
@@ -55,7 +67,7 @@ jobs:
5567
working-directory: example
5668

5769
- name: Restore Pods cache
58-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684
70+
uses: actions/cache@v5
5971
with:
6072
path: |
6173
example/ios/Pods

0 commit comments

Comments
 (0)