我正在使用GitHub操作来构建我的TypeScript项目.
有没有办法缓存Yarn 相关性,这样构建时间会更快?
我试过这个:
- name: Get yarn cache directory path
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
但构建时间仍然是一样的.