Speed up and refactor main workflow: - Take advantage of re-usable node/pnpm setup action - Remove explicit fetch-depth - Clean up timeout-minutes
77 lines
2.0 KiB
YAML
77 lines
2.0 KiB
YAML
name: Setup node and pnpm
|
|
description: |
|
|
Configures Node, pnpm, cache, performs pnpm install
|
|
|
|
inputs:
|
|
node-version:
|
|
description: Node.js version
|
|
required: true
|
|
default: 22.6.0
|
|
pnpm-version:
|
|
description: Pnpm version
|
|
required: true
|
|
default: 9.7.1
|
|
pnpm-run-install:
|
|
description: Whether to run pnpm install
|
|
required: false
|
|
default: true
|
|
pnpm-restore-cache:
|
|
description: Whether to restore cache
|
|
required: false
|
|
default: true
|
|
pnpm-install-cache-key:
|
|
description: The cache key for the pnpm install cache
|
|
default: pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
|
|
outputs:
|
|
pnpm-store-path:
|
|
description: The resolved pnpm store path
|
|
pnpm-install-cache-key:
|
|
description: The cache key used for pnpm install cache
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
# https://github.com/actions/virtual-environments/issues/1187
|
|
- name: tune linux network
|
|
shell: bash
|
|
run: sudo ethtool -K eth0 tx off rx off
|
|
|
|
- name: Setup Node@${{ inputs.node-version }}
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ inputs.node-version }}
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: ${{ inputs.pnpm-version }}
|
|
run_install: false
|
|
|
|
- name: Get pnpm store path
|
|
shell: bash
|
|
run: |
|
|
STORE_PATH=$(pnpm store path --silent)
|
|
echo "STORE_PATH=$STORE_PATH" >> $GITHUB_ENV
|
|
echo "Pnpm store path resolved to: $STORE_PATH"
|
|
|
|
- name: Restore pnpm install cache
|
|
if: ${{ inputs.pnpm-restore-cache == 'true' }}
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ env.STORE_PATH }}
|
|
key: ${{ inputs.pnpm-install-cache-key }}
|
|
restore-keys: |
|
|
pnpm-store-${{ inputs.pnpm-version }}-
|
|
pnpm-store-
|
|
|
|
- name: Run pnpm install
|
|
if: ${{ inputs.pnpm-run-install == 'true' }}
|
|
shell: bash
|
|
run: pnpm install
|
|
|
|
# Set the cache key output
|
|
- run: |
|
|
echo "pnpm-install-cache-key=${{ inputs.pnpm-install-cache-key }}" >> $GITHUB_ENV
|
|
shell: bash
|