From 73e15250cbce81f89bcc40228d2de77d244ed0d6 Mon Sep 17 00:00:00 2001 From: Nelson Martell Date: Fri, 6 May 2022 21:25:47 -0500 Subject: [PATCH 1/2] docs(readme): improve and fix cache example Dynamically detect the Store directory and use the latest GitHub actions. --- README.md | 47 +++++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 24bae0e..15eee5a 100644 --- a/README.md +++ b/README.md @@ -99,24 +99,39 @@ on: jobs: cache-and-install: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - build: - - uses: actions/checkout@v2 - - - name: Cache pnpm modules - uses: actions/cache@v2 - with: - path: ~/.pnpm-store - key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}- - - - uses: pnpm/action-setup@v2.1.0 - with: - version: 6.0.2 - run_install: true + - name: Checkout + uses: actions/checkout@v3 + + - name: Install Node.js + uses: actions/setup-node@v3 + with: + node-version: 16 + + - uses: pnpm/action-setup@v2.0.1 + name: Install pnpm + id: pnpm-install + with: + version: 7 + run_install: false + + - name: Get pnpm store directory + id: pnpm-cache + run: | + echo "::set-output name=pnpm_cache_dir::$(pnpm store path)" + + - uses: actions/cache@v3 + name: Setup pnpm cache + with: + path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + run: pnpm install ``` **Note:** You don't need to run `pnpm store prune` at the end; post-action has already taken care of that. From ec1a8b444c305a054c47a57c3f7835b3736aea2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kh=E1=BA=A3i?= Date: Sat, 7 May 2022 09:59:56 +0700 Subject: [PATCH 2/2] Change `runs-on` back to `ubuntu-latest` --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 15eee5a..2dab47d 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ on: jobs: cache-and-install: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - name: Checkout