I am currently utilizing GitHub Actions to compile my TypeScript project. Each time I execute the action, I have to wait for approximately 3 minutes for all dependencies to be installed.
Is there a method to cache yarn dependencies in order to reduce build time?
I attempted the following approach:
- name: Obtain the directory path for yarn cache
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install yarn
run: npm install -g yarn
- name: Install project dependencies
run: yarn
However, despite implementing this strategy, the build time remains unchanged.