mirror of
https://github.com/renovatebot/github-action.git
synced 2025-12-16 08:52:35 +00:00
| datasource | package | from | to | | ----------- | ------------------ | ------ | ------ | | github-tags | actions/setup-node | v6.0.0 | v6.1.0 |
60 lines
1.8 KiB
YAML
60 lines
1.8 KiB
YAML
name: 'Setup Node.js'
|
|
description: 'Setup Node and install dependencies using cache'
|
|
inputs:
|
|
save-cache:
|
|
description: 'Save cache when needed'
|
|
required: false
|
|
default: 'false'
|
|
|
|
runs:
|
|
using: 'composite'
|
|
|
|
steps:
|
|
- name: ⚙️ Calculate `CACHE_KEY`
|
|
shell: bash
|
|
run: |
|
|
echo 'CACHE_KEY=node_modules-${{
|
|
hashFiles('.node-version', 'pnpm-lock.yaml')
|
|
}}' >> "$GITHUB_ENV"
|
|
|
|
- name: ♻️ Restore `node_modules`
|
|
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
|
|
id: node-modules-restore
|
|
with:
|
|
path: node_modules
|
|
key: ${{ env.CACHE_KEY }}
|
|
enableCrossOsArchive: true
|
|
|
|
- name: Calculate `CACHE_HIT`
|
|
shell: bash
|
|
run: |
|
|
echo 'CACHE_HIT=${{
|
|
(steps.node-modules-restore.outputs.cache-hit == 'true') && 'true' || ''
|
|
}}' >> "$GITHUB_ENV"
|
|
|
|
- name: ⚙️ Setup pnpm
|
|
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
|
|
with:
|
|
standalone: true
|
|
|
|
- name: ⚙️ Setup Node.js ${{ inputs.node-version }}
|
|
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
|
with:
|
|
node-version-file: .node-version
|
|
cache: ${{ env.CACHE_HIT != 'true' && 'pnpm' || '' }}
|
|
|
|
- name: 📥 Install dependencies
|
|
if: env.CACHE_HIT != 'true'
|
|
shell: bash
|
|
run: pnpm install --frozen-lockfile
|
|
env:
|
|
# Other environment variables
|
|
HUSKY: '0' # By default do not run HUSKY install
|
|
|
|
- name: ♻️ Write `node_modules` cache
|
|
if: inputs.save-cache == 'true' && env.CACHE_HIT != 'true'
|
|
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
|
|
with:
|
|
path: node_modules
|
|
key: ${{ env.CACHE_KEY }}
|
|
enableCrossOsArchive: true
|