diff --git a/.github/workflows/preview-cli-package.yml b/.github/workflows/preview-cli-package.yml index 2e7c048..6306986 100644 --- a/.github/workflows/preview-cli-package.yml +++ b/.github/workflows/preview-cli-package.yml @@ -25,14 +25,24 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} persist-credentials: false - - uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 - with: - version: 10.30.0 - - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e with: node-version: 24 - cache: pnpm + + - name: Enable pnpm + run: | + corepack enable + PNPM_VERSION="$(node -p 'const pm = require("./package.json").packageManager; const match = pm && pm.match(/^pnpm@(.+)$/); if (!match) throw new Error("packageManager must be pnpm@"); match[1]')" + corepack prepare "pnpm@${PNPM_VERSION}" --activate + echo "PNPM_STORE_PATH=$(pnpm store path)" >> "$GITHUB_ENV" + + - name: Cache pnpm store + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 + with: + path: ${{ env.PNPM_STORE_PATH }} + key: pnpm-store-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} + restore-keys: | + pnpm-store-${{ runner.os }}- - name: Install dependencies run: pnpm install --frozen-lockfile diff --git a/.github/workflows/publish-cli.yml b/.github/workflows/publish-cli.yml index 28f95a3..a160991 100644 --- a/.github/workflows/publish-cli.yml +++ b/.github/workflows/publish-cli.yml @@ -29,15 +29,25 @@ jobs: with: persist-credentials: false - - uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 - with: - version: 10.30.0 - - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e with: node-version: 24 registry-url: https://registry.npmjs.org - cache: pnpm + + - name: Enable pnpm + run: | + corepack enable + PNPM_VERSION="$(node -p 'const pm = require("./package.json").packageManager; const match = pm && pm.match(/^pnpm@(.+)$/); if (!match) throw new Error("packageManager must be pnpm@"); match[1]')" + corepack prepare "pnpm@${PNPM_VERSION}" --activate + echo "PNPM_STORE_PATH=$(pnpm store path)" >> "$GITHUB_ENV" + + - name: Cache pnpm store + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 + with: + path: ${{ env.PNPM_STORE_PATH }} + key: pnpm-store-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} + restore-keys: | + pnpm-store-${{ runner.os }}- - name: Install dependencies run: pnpm install --frozen-lockfile @@ -146,15 +156,25 @@ jobs: fetch-depth: 0 persist-credentials: false - - uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 - with: - version: 10.30.0 - - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e with: node-version: 24 registry-url: https://registry.npmjs.org - cache: pnpm + + - name: Enable pnpm + run: | + corepack enable + PNPM_VERSION="$(node -p 'const pm = require("./package.json").packageManager; const match = pm && pm.match(/^pnpm@(.+)$/); if (!match) throw new Error("packageManager must be pnpm@"); match[1]')" + corepack prepare "pnpm@${PNPM_VERSION}" --activate + echo "PNPM_STORE_PATH=$(pnpm store path)" >> "$GITHUB_ENV" + + - name: Cache pnpm store + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 + with: + path: ${{ env.PNPM_STORE_PATH }} + key: pnpm-store-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} + restore-keys: | + pnpm-store-${{ runner.os }}- - name: Install dependencies run: pnpm install --frozen-lockfile