mirror of
				https://kkgithub.com/actions/setup-node.git
				synced 2025-11-04 12:46:16 +08:00 
			
		
		
		
	Updated documentation/workflows to use actions/setup-node@v3 (#433)
				
					
				
			* Update documentation `actions/setup-node@v2` -> `actions/setup-node@v3` * Bump workflows to `actions/setup-node@v3` * Update `README.md` workflow status badges to new format
This commit is contained in:
		
							
								
								
									
										4
									
								
								.github/workflows/build-test.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.github/workflows/build-test.yml
									
									
									
									
										vendored
									
									
								
							@ -19,8 +19,8 @@ jobs:
 | 
				
			|||||||
        os: [ubuntu-latest, windows-latest, macos-latest]
 | 
					        os: [ubuntu-latest, windows-latest, macos-latest]
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      - uses: actions/checkout@v2
 | 
					      - uses: actions/checkout@v2
 | 
				
			||||||
      - name: Setup node 16
 | 
					      - name: Setup Node 16.x
 | 
				
			||||||
        uses: actions/setup-node@v2
 | 
					        uses: actions/setup-node@v3
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          node-version: 16.x
 | 
					          node-version: 16.x
 | 
				
			||||||
          cache: npm
 | 
					          cache: npm
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										4
									
								
								.github/workflows/check-dist.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.github/workflows/check-dist.yml
									
									
									
									
										vendored
									
									
								
							@ -23,8 +23,8 @@ jobs:
 | 
				
			|||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      - uses: actions/checkout@v2
 | 
					      - uses: actions/checkout@v2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      - name: Set Node.js 16.x
 | 
					      - name: Setup Node 16.x
 | 
				
			||||||
        uses: actions/setup-node@v2
 | 
					        uses: actions/setup-node@v3
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          node-version: 16.x
 | 
					          node-version: 16.x
 | 
				
			||||||
          cache: npm
 | 
					          cache: npm
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										16
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								README.md
									
									
									
									
									
								
							@ -1,8 +1,8 @@
 | 
				
			|||||||
# setup-node
 | 
					# setup-node
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<p align="left">
 | 
					[](https://github.com/actions/setup-node/actions/workflows/build-test.yml)
 | 
				
			||||||
  <a href="https://github.com/actions/setup-node/actions?query=workflow%3Abuild-test"><img alt="build-test status" src="https://github.com/actions/setup-node/workflows/build-test/badge.svg"></a> <a href="https://github.com/actions/setup-node/actions?query=workflow%3Aversions"><img alt="versions status" src="https://github.com/actions/setup-node/workflows/versions/badge.svg"></a> <a href="https://github.com/actions/setup-node/actions?query=workflow%3Aproxy"><img alt="proxy status" src="https://github.com/actions/setup-node/workflows/proxy/badge.svg"></a> 
 | 
					[](https://github.com/actions/setup-node/actions/workflows/versions.yml)
 | 
				
			||||||
</p>
 | 
					[](https://github.com/actions/setup-node/actions/workflows/proxy.yml)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
This action provides the following functionality for GitHub Actions users:
 | 
					This action provides the following functionality for GitHub Actions users:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -19,7 +19,7 @@ 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
 | 
				
			||||||
@ -33,6 +33,7 @@ The action will first check the local cache for a semver match. If unable to fin
 | 
				
			|||||||
For information regarding locally cached versions of Node.js on GitHub hosted runners, check out [GitHub Actions Virtual Environments](https://github.com/actions/virtual-environments).
 | 
					For information regarding locally cached versions of Node.js on GitHub hosted runners, check out [GitHub Actions Virtual Environments](https://github.com/actions/virtual-environments).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### 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`
 | 
				
			||||||
@ -51,7 +52,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 +64,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'
 | 
				
			||||||
@ -73,6 +74,7 @@ steps:
 | 
				
			|||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Matrix Testing:
 | 
					## Matrix Testing:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
jobs:
 | 
					jobs:
 | 
				
			||||||
  build:
 | 
					  build:
 | 
				
			||||||
@ -84,7 +86,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
 | 
				
			||||||
@ -28,7 +28,7 @@ See [supported version syntax](https://github.com/actions/setup-node#supported-v
 | 
				
			|||||||
```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
 | 
				
			||||||
@ -63,7 +63,7 @@ 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'
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user