From 717dffdb816617db24d4533b646f9de7824e649d Mon Sep 17 00:00:00 2001 From: Satyajit Sahoo Date: Wed, 27 May 2020 13:14:08 +0200 Subject: [PATCH] chore: improve caching of yarn on gh actions --- .github/workflows/expo-preview.yml | 18 ++++++++---------- .github/workflows/expo.yml | 17 ++++++++--------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/.github/workflows/expo-preview.yml b/.github/workflows/expo-preview.yml index 5aacb6ef..3f0993b7 100644 --- a/.github/workflows/expo-preview.yml +++ b/.github/workflows/expo-preview.yml @@ -23,20 +23,18 @@ jobs: expo-password: ${{ secrets.EXPO_CLI_PASSWORD }} expo-cache: true - - name: Get yarn cache + - name: Restore yarn cache id: yarn-cache - run: echo "::set-output name=dir::$(yarn cache dir)" - - - name: Check yarn cache - uses: actions/cache@v1 + uses: actions/cache@master with: - path: ${{ steps.yarn-cache.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- + path: | + node_modules + */*/node_modules + key: ${{ runner.os }}-yarn-v1-${{ hashFiles('**/yarn.lock') }} - name: Install dependencies - run: yarn + if: steps.yarn-cache.outputs.cache-hit != 'true' + run: yarn install --frozen-lockfile - name: Publish Expo app working-directory: ./example diff --git a/.github/workflows/expo.yml b/.github/workflows/expo.yml index 93d4efd1..34be1ab1 100644 --- a/.github/workflows/expo.yml +++ b/.github/workflows/expo.yml @@ -25,19 +25,18 @@ jobs: expo-password: ${{ secrets.EXPO_CLI_PASSWORD }} expo-cache: true - - name: Get yarn cache + - name: Restore yarn cache id: yarn-cache - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v1 + uses: actions/cache@master with: - path: ${{ steps.yarn-cache.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- + path: | + node_modules + */*/node_modules + key: ${{ runner.os }}-yarn-v1-${{ hashFiles('**/yarn.lock') }} - name: Install dependencies - run: yarn + if: steps.yarn-cache.outputs.cache-hit != 'true' + run: yarn install --frozen-lockfile - name: Publish Expo app working-directory: ./example