mirror of
				https://github.com/actions/setup-node.git
				synced 2025-11-04 01:33:33 +00:00 
			
		
		
		
	Update documentation actions/setup-node@v2 -> actions/setup-node@v3
				
					
				
			This commit is contained in:
		
							parent
							
								
									9ced9a43a2
								
							
						
					
					
						commit
						aa73a9054e
					
				
							
								
								
									
										16
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								README.md
									
									
									
									
									
								
							@ -19,14 +19,14 @@ See [action.yml](action.yml)
 | 
				
			|||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
steps:
 | 
					steps:
 | 
				
			||||||
- uses: actions/checkout@v2
 | 
					- uses: actions/checkout@v2
 | 
				
			||||||
- uses: actions/setup-node@v2
 | 
					- uses: actions/setup-node@v3
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    node-version: '14'
 | 
					    node-version: '14'
 | 
				
			||||||
- run: npm install
 | 
					- run: npm install
 | 
				
			||||||
- run: npm test
 | 
					- run: npm test
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The `node-version` input is optional. If not supplied, the node version from PATH will be used. However, it is recommended to always specify Node.js version and don't rely on the system one.  
 | 
					The `node-version` input is optional. If not supplied, the node version from PATH will be used. However, it is recommended to always specify Node.js version and don't rely on the system one.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The action will first check the local cache for a semver match. If unable to find a specific version in the cache, the action will attempt to download a version of Node.js. It will pull LTS versions from [node-versions releases](https://github.com/actions/node-versions/releases) and on miss or failure will fall back to the previous behavior of downloading directly from [node dist](https://nodejs.org/dist/).
 | 
					The action will first check the local cache for a semver match. If unable to find a specific version in the cache, the action will attempt to download a version of Node.js. It will pull LTS versions from [node-versions releases](https://github.com/actions/node-versions/releases) and on miss or failure will fall back to the previous behavior of downloading directly from [node dist](https://nodejs.org/dist/).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -35,9 +35,9 @@ For information regarding locally cached versions of Node.js on GitHub hosted ru
 | 
				
			|||||||
#### Supported version syntax
 | 
					#### Supported version syntax
 | 
				
			||||||
The `node-version` input supports the following syntax:
 | 
					The `node-version` input supports the following syntax:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
major versions: `12`, `14`, `16`  
 | 
					major versions: `12`, `14`, `16`
 | 
				
			||||||
more specific versions: `10.15`, `14.2.0`, `16.3.0`  
 | 
					more specific versions: `10.15`, `14.2.0`, `16.3.0`
 | 
				
			||||||
nvm lts syntax: `lts/erbium`, `lts/fermium`, `lts/*`  
 | 
					nvm lts syntax: `lts/erbium`, `lts/fermium`, `lts/*`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Caching packages dependencies
 | 
					## Caching packages dependencies
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -51,7 +51,7 @@ See the examples of using cache for `yarn` / `pnpm` and  `cache-dependency-path`
 | 
				
			|||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
steps:
 | 
					steps:
 | 
				
			||||||
- uses: actions/checkout@v2
 | 
					- uses: actions/checkout@v2
 | 
				
			||||||
- uses: actions/setup-node@v2
 | 
					- uses: actions/setup-node@v3
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    node-version: '14'
 | 
					    node-version: '14'
 | 
				
			||||||
    cache: 'npm'
 | 
					    cache: 'npm'
 | 
				
			||||||
@ -63,7 +63,7 @@ steps:
 | 
				
			|||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
steps:
 | 
					steps:
 | 
				
			||||||
- uses: actions/checkout@v2
 | 
					- uses: actions/checkout@v2
 | 
				
			||||||
- uses: actions/setup-node@v2
 | 
					- uses: actions/setup-node@v3
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    node-version: '14'
 | 
					    node-version: '14'
 | 
				
			||||||
    cache: 'npm'
 | 
					    cache: 'npm'
 | 
				
			||||||
@ -84,7 +84,7 @@ jobs:
 | 
				
			|||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      - uses: actions/checkout@v2
 | 
					      - uses: actions/checkout@v2
 | 
				
			||||||
      - name: Setup node
 | 
					      - name: Setup node
 | 
				
			||||||
        uses: actions/setup-node@v2
 | 
					        uses: actions/setup-node@v3
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          node-version: ${{ matrix.node }}
 | 
					          node-version: ${{ matrix.node }}
 | 
				
			||||||
      - run: npm install
 | 
					      - run: npm install
 | 
				
			||||||
 | 
				
			|||||||
@ -11,7 +11,7 @@ If `check-latest` is set to `true`, the action first checks if the cached versio
 | 
				
			|||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
steps:
 | 
					steps:
 | 
				
			||||||
- uses: actions/checkout@v2
 | 
					- uses: actions/checkout@v2
 | 
				
			||||||
- uses: actions/setup-node@v2
 | 
					- uses: actions/setup-node@v3
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    node-version: '14'
 | 
					    node-version: '14'
 | 
				
			||||||
    check-latest: true
 | 
					    check-latest: true
 | 
				
			||||||
@ -20,15 +20,15 @@ steps:
 | 
				
			|||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Node version file
 | 
					## Node version file
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
The `node-version-file` input accepts a path to a file containing the version of Node.js to be used by a project, for example `.nvmrc` or `.node-version`. If both the `node-version` and the `node-version-file` inputs are provided then the `node-version` input is used. 
 | 
					The `node-version-file` input accepts a path to a file containing the version of Node.js to be used by a project, for example `.nvmrc` or `.node-version`. If both the `node-version` and the `node-version-file` inputs are provided then the `node-version` input is used.
 | 
				
			||||||
See [supported version syntax](https://github.com/actions/setup-node#supported-version-syntax) 
 | 
					See [supported version syntax](https://github.com/actions/setup-node#supported-version-syntax)
 | 
				
			||||||
> The action will search for the node version file relative to the repository root.
 | 
					> The action will search for the node version file relative to the repository root.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
steps:
 | 
					steps:
 | 
				
			||||||
- uses: actions/checkout@v2
 | 
					- uses: actions/checkout@v2
 | 
				
			||||||
- uses: actions/setup-node@v2
 | 
					- uses: actions/setup-node@v3
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    node-version-file: '.nvmrc'
 | 
					    node-version-file: '.nvmrc'
 | 
				
			||||||
- run: npm install
 | 
					- run: npm install
 | 
				
			||||||
@ -47,7 +47,7 @@ jobs:
 | 
				
			|||||||
    name: Node sample
 | 
					    name: Node sample
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      - uses: actions/checkout@v2
 | 
					      - uses: actions/checkout@v2
 | 
				
			||||||
      - uses: actions/setup-node@v2
 | 
					      - uses: actions/setup-node@v3
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          node-version: '14'
 | 
					          node-version: '14'
 | 
				
			||||||
          architecture: 'x64' # optional, x64 or x86. If not specified, x64 will be used by default
 | 
					          architecture: 'x64' # optional, x64 or x86. If not specified, x64 will be used by default
 | 
				
			||||||
@ -58,12 +58,12 @@ jobs:
 | 
				
			|||||||
## Caching packages dependencies
 | 
					## Caching packages dependencies
 | 
				
			||||||
The action follows [actions/cache](https://github.com/actions/cache/blob/main/examples.md#node---npm) guidelines, and caches global cache on the machine instead of `node_modules`, so cache can be reused between different Node.js versions.
 | 
					The action follows [actions/cache](https://github.com/actions/cache/blob/main/examples.md#node---npm) guidelines, and caches global cache on the machine instead of `node_modules`, so cache can be reused between different Node.js versions.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**Caching yarn dependencies:**  
 | 
					**Caching yarn dependencies:**
 | 
				
			||||||
Yarn caching handles both yarn versions: 1 or 2.
 | 
					Yarn caching handles both yarn versions: 1 or 2.
 | 
				
			||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
steps:
 | 
					steps:
 | 
				
			||||||
- uses: actions/checkout@v2
 | 
					- uses: actions/checkout@v2
 | 
				
			||||||
- uses: actions/setup-node@v2
 | 
					- uses: actions/setup-node@v3
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    node-version: '14'
 | 
					    node-version: '14'
 | 
				
			||||||
    cache: 'yarn'
 | 
					    cache: 'yarn'
 | 
				
			||||||
@ -85,7 +85,7 @@ steps:
 | 
				
			|||||||
- uses: pnpm/action-setup@646cdf48217256a3d0b80361c5a50727664284f2
 | 
					- uses: pnpm/action-setup@646cdf48217256a3d0b80361c5a50727664284f2
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    version: 6.10.0
 | 
					    version: 6.10.0
 | 
				
			||||||
- uses: actions/setup-node@v2
 | 
					- uses: actions/setup-node@v3
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    node-version: '14'
 | 
					    node-version: '14'
 | 
				
			||||||
    cache: 'pnpm'
 | 
					    cache: 'pnpm'
 | 
				
			||||||
@ -97,7 +97,7 @@ steps:
 | 
				
			|||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
steps:
 | 
					steps:
 | 
				
			||||||
- uses: actions/checkout@v2
 | 
					- uses: actions/checkout@v2
 | 
				
			||||||
- uses: actions/setup-node@v2
 | 
					- uses: actions/setup-node@v3
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    node-version: '14'
 | 
					    node-version: '14'
 | 
				
			||||||
    cache: 'npm'
 | 
					    cache: 'npm'
 | 
				
			||||||
@ -110,7 +110,7 @@ steps:
 | 
				
			|||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
steps:
 | 
					steps:
 | 
				
			||||||
- uses: actions/checkout@v2
 | 
					- uses: actions/checkout@v2
 | 
				
			||||||
- uses: actions/setup-node@v2
 | 
					- uses: actions/setup-node@v3
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    node-version: '14'
 | 
					    node-version: '14'
 | 
				
			||||||
    cache: 'npm'
 | 
					    cache: 'npm'
 | 
				
			||||||
@ -148,7 +148,7 @@ jobs:
 | 
				
			|||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      - uses: actions/checkout@v2
 | 
					      - uses: actions/checkout@v2
 | 
				
			||||||
      - name: Setup node
 | 
					      - name: Setup node
 | 
				
			||||||
        uses: actions/setup-node@v2
 | 
					        uses: actions/setup-node@v3
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          node-version: ${{ matrix.node_version }}
 | 
					          node-version: ${{ matrix.node_version }}
 | 
				
			||||||
          architecture: ${{ matrix.architecture }}
 | 
					          architecture: ${{ matrix.architecture }}
 | 
				
			||||||
@ -160,7 +160,7 @@ jobs:
 | 
				
			|||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
steps:
 | 
					steps:
 | 
				
			||||||
- uses: actions/checkout@v2
 | 
					- uses: actions/checkout@v2
 | 
				
			||||||
- uses: actions/setup-node@v2
 | 
					- uses: actions/setup-node@v3
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    node-version: '14.x'
 | 
					    node-version: '14.x'
 | 
				
			||||||
    registry-url: 'https://registry.npmjs.org'
 | 
					    registry-url: 'https://registry.npmjs.org'
 | 
				
			||||||
@ -168,7 +168,7 @@ steps:
 | 
				
			|||||||
- run: npm publish
 | 
					- run: npm publish
 | 
				
			||||||
  env:
 | 
					  env:
 | 
				
			||||||
    NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
 | 
					    NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
 | 
				
			||||||
- uses: actions/setup-node@v2
 | 
					- uses: actions/setup-node@v3
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    registry-url: 'https://npm.pkg.github.com'
 | 
					    registry-url: 'https://npm.pkg.github.com'
 | 
				
			||||||
- run: npm publish
 | 
					- run: npm publish
 | 
				
			||||||
@ -180,7 +180,7 @@ steps:
 | 
				
			|||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
steps:
 | 
					steps:
 | 
				
			||||||
- uses: actions/checkout@v2
 | 
					- uses: actions/checkout@v2
 | 
				
			||||||
- uses: actions/setup-node@v2
 | 
					- uses: actions/setup-node@v3
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    node-version: '14.x'
 | 
					    node-version: '14.x'
 | 
				
			||||||
    registry-url: <registry url>
 | 
					    registry-url: <registry url>
 | 
				
			||||||
@ -188,7 +188,7 @@ steps:
 | 
				
			|||||||
- run: yarn publish
 | 
					- run: yarn publish
 | 
				
			||||||
  env:
 | 
					  env:
 | 
				
			||||||
    NODE_AUTH_TOKEN: ${{ secrets.YARN_TOKEN }}
 | 
					    NODE_AUTH_TOKEN: ${{ secrets.YARN_TOKEN }}
 | 
				
			||||||
- uses: actions/setup-node@v2
 | 
					- uses: actions/setup-node@v3
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    registry-url: 'https://npm.pkg.github.com'
 | 
					    registry-url: 'https://npm.pkg.github.com'
 | 
				
			||||||
- run: yarn publish
 | 
					- run: yarn publish
 | 
				
			||||||
@ -200,7 +200,7 @@ steps:
 | 
				
			|||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
steps:
 | 
					steps:
 | 
				
			||||||
- uses: actions/checkout@v2
 | 
					- uses: actions/checkout@v2
 | 
				
			||||||
- uses: actions/setup-node@v2
 | 
					- uses: actions/setup-node@v3
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    node-version: '14.x'
 | 
					    node-version: '14.x'
 | 
				
			||||||
    registry-url: 'https://registry.npmjs.org'
 | 
					    registry-url: 'https://registry.npmjs.org'
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user