Skip to content

ci: use cache yarn #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 21 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,23 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: 12
- id: yarn-cache-dir
name: Find Yarn's cache folder
run: echo "::set-output name=path::$(yarn config get cacheFolder)"
- name: Cache node modules
uses: actions/cache@v2
id: yarn-cache
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
path: ${{ steps.yarn-cache-dir.outputs.path }}
key: ${{ runner.os }}-yarn-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-yarn-${{ env.cache-name }}-
${{ runner.os }}-yarn-
${{ runner.os }}-
- name: Install dependencies
# if: ${{ !steps.yarn-cache.outputs.cache-hit }}
env:
CI: true
run: |
Expand All @@ -49,19 +53,24 @@ jobs:
- uses: actions/setup-node@v2
with:
node-version: 12
- id: yarn-cache-dir
name: Find Yarn's cache folder
run: echo "::set-output name=path::$(yarn config get cacheFolder)"
- name: Cache node modules
uses: actions/cache@v2
id: yarn-cache
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
path: ${{ steps.yarn-cache-dir.outputs.path }}
key: ${{ runner.os }}-yarn-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-yarn-${{ env.cache-name }}-
${{ runner.os }}-yarn-
${{ runner.os }}-
- env:
- name: Install dependencies
# if: ${{ !steps.yarn-cache.outputs.cache-hit }}
env:
CI: true
run: |
yarn install
Expand All @@ -70,6 +79,6 @@ jobs:
env:
CI: true
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
33 changes: 21 additions & 12 deletions .github/workflows/test.release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,23 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: 12
- id: yarn-cache-dir
name: Find Yarn's cache folder
run: echo "::set-output name=path::$(yarn config get cacheFolder)"
- name: Cache node modules
uses: actions/cache@v2
id: yarn-cache
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
path: ${{ steps.yarn-cache-dir.outputs.path }}
key: ${{ runner.os }}-yarn-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-yarn-${{ env.cache-name }}-
${{ runner.os }}-yarn-
${{ runner.os }}-
- name: Install dependencies
# if: ${{ !steps.yarn-cache.outputs.cache-hit }}
env:
CI: true
run: |
Expand All @@ -41,19 +45,24 @@ jobs:
- uses: actions/setup-node@v2
with:
node-version: 12
- id: yarn-cache-dir
name: Find Yarn's cache folder
run: echo "::set-output name=path::$(yarn config get cacheFolder)"
- name: Cache node modules
uses: actions/cache@v2
id: yarn-cache
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
path: ${{ steps.yarn-cache-dir.outputs.path }}
key: ${{ runner.os }}-yarn-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-yarn-${{ env.cache-name }}-
${{ runner.os }}-yarn-
${{ runner.os }}-
- env:
- name: Install dependencies
# if: ${{ !steps.yarn-cache.outputs.cache-hit }}
env:
CI: true
run: |
yarn install
Expand All @@ -62,7 +71,7 @@ jobs:
CI: true
GH_TOKEN: "${{ secrets.GH_TOKEN }}"
GITHUB_HEAD_REF: $GITHUB_HEAD_REF
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
GITHUB_TOKEN: "${{ secrets.GH_TOKEN }}"
NPM_TOKEN: "${{ secrets.NPM_TOKEN }}"
run: |
echo "//npm.pkg.github.com/:_authToken=$GITHUB_TOKEN" > /home/runner/work/_temp/.npmrc
Expand Down