diff --git a/.github/workflows/app-test.yml b/.github/workflows/app-test.yml index 42d1e2a..65cb806 100644 --- a/.github/workflows/app-test.yml +++ b/.github/workflows/app-test.yml @@ -23,17 +23,27 @@ jobs: uses: actions/setup-node@v4 with: node-version-file: ".nvmrc" - cache: "yarn" + + - name: Enable Corepack + run: corepack enable - name: Get yarn cache directory path id: yarn-cache-dir-path - run: echo "YARN_CACHE_DIR=$(yarn cache dir)" >> $GITHUB_ENV + run: | + YARN_MAJOR=$(yarn --version | cut -d. -f1) + if [ "$YARN_MAJOR" = "1" ]; then + CACHE_DIR=$(yarn cache dir) + else + CACHE_DIR=$(yarn config get cacheFolder) + fi + if [ -z "$CACHE_DIR" ]; then CACHE_DIR="$RUNNER_TEMP/yarn-cache"; fi + echo "ACTIONS_YARN_CACHE_PATH=$CACHE_DIR" >> $GITHUB_ENV - name: Cache yarn dependencies - uses: actions/cache@v3 + uses: actions/cache@v5 id: yarn-cache with: - path: ${{ env.YARN_CACHE_DIR }} + path: ${{ env.ACTIONS_YARN_CACHE_PATH }} key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: | ${{ runner.os }}-yarn- diff --git a/.github/workflows/bundlemon-build-size.yml b/.github/workflows/bundlemon-build-size.yml index 518994e..4e975b3 100644 --- a/.github/workflows/bundlemon-build-size.yml +++ b/.github/workflows/bundlemon-build-size.yml @@ -56,11 +56,34 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v4 with: - node-version-file: '.nvmrc' # Use the Node.js version specified in .nvmrc - cache: 'yarn' + node-version-file: '.nvmrc' + + - name: Enable Corepack + run: corepack enable + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: | + YARN_MAJOR=$(yarn --version | cut -d. -f1) + if [ "$YARN_MAJOR" = "1" ]; then + CACHE_DIR=$(yarn cache dir) + else + CACHE_DIR=$(yarn config get cacheFolder) + fi + if [ -z "$CACHE_DIR" ]; then CACHE_DIR="$RUNNER_TEMP/yarn-cache"; fi + echo "ACTIONS_YARN_CACHE_PATH=$CACHE_DIR" >> $GITHUB_ENV + + - name: Cache yarn dependencies + uses: actions/cache@v5 + id: yarn-cache + with: + path: ${{ env.ACTIONS_YARN_CACHE_PATH }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- - name: Cache npm for npx-scoped tools - uses: actions/cache@v3 + uses: actions/cache@v5 with: path: ~/.npm key: ${{ runner.os }}-npm-npx