|
1 | | -name: PNPM Cache Workflow |
| 1 | +name: PNPM Cache Example |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | workflow_call: |
5 | | - |
6 | 5 |
|
7 | 6 | jobs: |
8 | | - pnpm-cache-job: |
9 | | - runs-on: self-hosted |
| 7 | + install: |
| 8 | + runs-on: ubuntu-latest |
10 | 9 |
|
11 | 10 | steps: |
12 | | - - name: Checkout code |
13 | | - uses: actions/checkout@v4 |
14 | | - |
15 | | - - name: Setup Node.js |
16 | | - uses: actions/setup-node@v4 |
17 | | - with: |
18 | | - node-version: 18.20.4 |
19 | | - cache: 'pnpm' |
20 | | - |
21 | | - - name: Get PNPM store path |
22 | | - id: pnpm-store |
23 | | - run: | |
24 | | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV |
25 | | -
|
26 | | - - name: Restore PNPM cache |
27 | | - uses: actions/cache@v4 |
28 | | - with: |
29 | | - path: ${{ env.STORE_PATH }} |
30 | | - key: pnpm-store-${{ runner.os }}-18.20.4-v1 |
31 | | - |
32 | | - - name: Install dependencies |
33 | | - run: pnpm install --no-strict-peer-dependencies --ignore-script |
34 | | - |
35 | | - - name: Save PNPM cache |
36 | | - uses: actions/cache/save@v4 |
37 | | - if: always() |
38 | | - with: |
39 | | - path: ${{ env.STORE_PATH }} |
40 | | - key: pnpm-store-${{ runner.os }}-18.20.4-v1 |
| 11 | + - uses: actions/checkout@v4 |
| 12 | + |
| 13 | + - name: Setup Node.js |
| 14 | + uses: actions/setup-node@v4 |
| 15 | + with: |
| 16 | + node-version: 18.20.4 |
| 17 | + cache: 'pnpm' |
| 18 | + |
| 19 | + - name: Install PNPM |
| 20 | + run: npm install -g pnpm |
| 21 | + |
| 22 | + - name: Show PNPM store path |
| 23 | + id: pnpm-cache-path |
| 24 | + run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_ENV |
| 25 | + |
| 26 | + - name: Restore PNPM cache |
| 27 | + uses: actions/cache@v4 |
| 28 | + with: |
| 29 | + path: ${{ env.STORE_PATH }} |
| 30 | + key: pnpm-store-${{ runner.os }}-18.20.4-v1 |
| 31 | + |
| 32 | + - name: Install dependencies |
| 33 | + run: pnpm install |
| 34 | + |
| 35 | + - name: Save PNPM cache |
| 36 | + uses: actions/cache@v4 |
| 37 | + with: |
| 38 | + path: ${{ env.STORE_PATH }} |
| 39 | + key: pnpm-store-${{ runner.os }}-18.20.4-v1 |
0 commit comments