Skip to content

Commit 9a29a6a

Browse files
committed
hore: cache in CI
1 parent 69e074b commit 9a29a6a

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,27 @@ jobs:
2424
uses: zcong1993/setup-timezone@master
2525
with:
2626
timezone: Asia/Shanghai
27+
2728
- uses: actions/checkout@v2
29+
2830
- name: Use Node.js ${{ matrix.node-version }}
2931
uses: actions/setup-node@v2
3032
with:
3133
node-version: ${{ matrix.node-version }}
34+
35+
- uses: actions/cache@v2
36+
with:
37+
path: |
38+
~/.npm
39+
node_modules
40+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
41+
restore-keys: |
42+
${{ runner.os }}-node-
43+
3244
- run: npm ci
33-
- run: npm run build --if-present
45+
- run: npm run build
3446
- run: npm test
47+
3548
- name: Coveralls
3649
uses: coverallsapp/github-action@master
3750
with:

.github/workflows/gh-pages.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,25 @@ jobs:
1818

1919
steps:
2020
- uses: actions/checkout@v2
21+
2122
- name: Use Node.js ${{ matrix.node-version }}
2223
uses: actions/setup-node@v2
2324
with:
2425
node-version: ${{ matrix.node-version }}
26+
27+
- uses: actions/cache@v2
28+
with:
29+
path: |
30+
~/.npm
31+
node_modules
32+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
33+
restore-keys: |
34+
${{ runner.os }}-node-
35+
2536
- run: npm ci
2637
- run: npm run build
2738
- run: cp _config.yml docs
39+
2840
- name: Deploy
2941
uses: peaceiris/actions-gh-pages@v3
3042
with:

.github/workflows/release-please.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,35 @@ jobs:
1313
release-type: node
1414
package-name: "@easyops-cn/brick-next-pipes"
1515
bump-minor-pre-major: true
16+
1617
# The logic below handles the npm publication:
1718
- uses: actions/checkout@v2
1819
# these if statements ensure that a publication only occurs when
1920
# a new release is created:
2021
if: ${{ steps.release.outputs.release_created }}
22+
2123
- uses: actions/setup-node@v1
2224
with:
2325
node-version: 14
2426
registry-url: 'https://registry.npmjs.org'
2527
if: ${{ steps.release.outputs.release_created }}
28+
29+
- uses: actions/cache@v2
30+
with:
31+
path: |
32+
~/.npm
33+
node_modules
34+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
35+
restore-keys: |
36+
${{ runner.os }}-node-
37+
if: ${{ steps.release.outputs.release_created }}
38+
2639
- run: npm ci
2740
if: ${{ steps.release.outputs.release_created }}
41+
2842
- run: npm run build
2943
if: ${{ steps.release.outputs.release_created }}
44+
3045
- run: npm publish
3146
env:
3247
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

0 commit comments

Comments
 (0)