Navigate:
Setup Node
~$SETU0.5%

setup-node: Configure Node.js in GitHub Actions

Node.js version management and dependency caching for workflows.

LIVE RANKINGS • 12:26 PM • STEADY
OVERALL
#227
66
CLOUD & DEVOPS
#13
4
30 DAY RANKING TREND
ovr#227
·Cloud#13
STARS
4.7K
FORKS
1.6K
7D STARS
+22
7D FORKS
+4
See Repo:
Share:

Learn more about Setup Node

setup-node is a GitHub Actions utility that configures Node.js runtime environments within continuous integration workflows. It downloads and installs specified Node.js versions from official distribution channels, sets up the appropriate PATH environment variables, and optionally configures package manager caching layers for npm, yarn, or pnpm. The action supports version resolution through exact version numbers, semantic version ranges, or symbolic references like LTS release channels. It implements matrix strategy compatibility to enable parallel testing across multiple Node.js versions and operating systems within a single workflow definition. The caching mechanism stores dependency directories between workflow runs using GitHub's cache service to reduce installation time in subsequent executions.

Setup Node

1

Dependency caching integration

Automatically detects and caches npm, yarn, or pnpm dependencies based on package manager configuration in package.json. Supports custom cache paths and multiple dependency file formats including package-lock.json, yarn.lock, and .tool-versions.

2

Version resolution flexibility

Accepts semantic versioning notation, version aliases (lts/*, latest, nightly, canary), and reads versions from multiple file formats (.nvmrc, .node-version, package.json). The check-latest option verifies available versions against the Node.js release repository.

3

Registry authentication configuration

Configures npm and yarn authentication at the project level through .npmrc and .yarnrc files, supporting both GPR (GitHub Package Registry) and custom npm registries via environment variables and token management.


// .github/workflows/test.yml
steps:
  - uses: actions/checkout@v4
  - uses: actions/setup-node@v4
    with:
      node-version: '20'
  - run: npm ci
  - run: npm test

vv6.2.0

Updates documentation and fixes various typos and mirror option issues

  • Documentation update related to absence of Lockfile
  • Correct mirror option typos
  • Readme update on checkout version v6
  • Advanced document update on checkout version v6
vv6.1.0

Removes always-auth configuration handling and upgrades dependencies

  • Remove always-auth configuration handling
  • Upgrade @actions/cache from 4.0.3 to 4.1.0
  • Upgrade actions/checkout from 5 to 6
  • Upgrade js-yaml from 3.14.1 to 3.14.2
  • Add example for restore-only cache in documentation
vv6.0.0

Limits automatic caching to npm only and includes breaking changes documentation

  • Limit automatic caching to npm, update workflows and documentation
  • Upgrade ts-jest from 29.1.2 to 29.4.1 and document breaking changes in v5
  • Upgrade prettier from 2.8.8 to 3.6.2
  • Upgrade actions/publish-action from 0.3.0 to 0.4.0


[ EXPLORE MORE ]

Related Repositories

Discover similar tools and frameworks used by developers