mirror of
				https://github.com/actions/setup-node.git
				synced 2025-11-04 13:29:12 +08:00 
			
		
		
		
	
							
								
								
									
										24
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								README.md
									
									
									
									
									
								
							@@ -11,7 +11,7 @@ This action provides the following functionality for GitHub Actions users:
 | 
				
			|||||||
- Registering problem matchers for error output
 | 
					- Registering problem matchers for error output
 | 
				
			||||||
- Configuring authentication for GPR or npm
 | 
					- Configuring authentication for GPR or npm
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Usage
 | 
					## Usage
 | 
				
			||||||
 | 
					
 | 
				
			||||||
See [action.yml](action.yml)
 | 
					See [action.yml](action.yml)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -22,7 +22,7 @@ steps:
 | 
				
			|||||||
- uses: actions/checkout@v3
 | 
					- uses: actions/checkout@v3
 | 
				
			||||||
- uses: actions/setup-node@v3
 | 
					- 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
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
@@ -33,7 +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:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -49,7 +49,7 @@ The action defaults to search for the dependency file (`package-lock.json` or `y
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
**Note:** The action does not cache `node_modules`
 | 
					**Note:** The action does not cache `node_modules`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
See the examples of using cache for `yarn` / `pnpm` and  `cache-dependency-path` input in the [Advanced usage](docs/advanced-usage.md#caching-packages-data) guide.
 | 
					See the examples of using cache for `yarn`/`pnpm` and `cache-dependency-path` input in the [Advanced usage](docs/advanced-usage.md#caching-packages-data) guide.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**Caching npm dependencies:**
 | 
					**Caching npm dependencies:**
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -58,7 +58,7 @@ steps:
 | 
				
			|||||||
- uses: actions/checkout@v3
 | 
					- uses: actions/checkout@v3
 | 
				
			||||||
- uses: actions/setup-node@v3
 | 
					- uses: actions/setup-node@v3
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    node-version: '14'
 | 
					    node-version: 14
 | 
				
			||||||
    cache: 'npm'
 | 
					    cache: 'npm'
 | 
				
			||||||
- run: npm install
 | 
					- run: npm install
 | 
				
			||||||
- run: npm test
 | 
					- run: npm test
 | 
				
			||||||
@@ -71,14 +71,14 @@ steps:
 | 
				
			|||||||
- uses: actions/checkout@v3
 | 
					- uses: actions/checkout@v3
 | 
				
			||||||
- uses: actions/setup-node@v3
 | 
					- uses: actions/setup-node@v3
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    node-version: '14'
 | 
					    node-version: 14
 | 
				
			||||||
    cache: 'npm'
 | 
					    cache: 'npm'
 | 
				
			||||||
    cache-dependency-path: subdir/package-lock.json
 | 
					    cache-dependency-path: subdir/package-lock.json
 | 
				
			||||||
- run: npm install
 | 
					- run: npm install
 | 
				
			||||||
- run: npm test
 | 
					- run: npm test
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Matrix Testing:
 | 
					## Matrix Testing
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
jobs:
 | 
					jobs:
 | 
				
			||||||
@@ -86,7 +86,7 @@ jobs:
 | 
				
			|||||||
    runs-on: ubuntu-latest
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
    strategy:
 | 
					    strategy:
 | 
				
			||||||
      matrix:
 | 
					      matrix:
 | 
				
			||||||
        node: [ '12', '14', '16' ]
 | 
					        node: [ 12, 14, 16 ]
 | 
				
			||||||
    name: Node ${{ matrix.node }} sample
 | 
					    name: Node ${{ matrix.node }} sample
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      - uses: actions/checkout@v3
 | 
					      - uses: actions/checkout@v3
 | 
				
			||||||
@@ -109,14 +109,14 @@ jobs:
 | 
				
			|||||||
7. [Publishing to npmjs and GPR with yarn](docs/advanced-usage.md#publish-to-npmjs-and-gpr-with-yarn)
 | 
					7. [Publishing to npmjs and GPR with yarn](docs/advanced-usage.md#publish-to-npmjs-and-gpr-with-yarn)
 | 
				
			||||||
8. [Using private packages](docs/advanced-usage.md#use-private-packages)
 | 
					8. [Using private packages](docs/advanced-usage.md#use-private-packages)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# License
 | 
					## License
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The scripts and documentation in this project are released under the [MIT License](LICENSE)
 | 
					The scripts and documentation in this project are released under the [MIT License](LICENSE)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Contributions
 | 
					## Contributions
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Contributions are welcome!  See [Contributor's Guide](docs/contributors.md)
 | 
					Contributions are welcome! See [Contributor's Guide](docs/contributors.md)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Code of Conduct
 | 
					## Code of Conduct
 | 
				
			||||||
 | 
					
 | 
				
			||||||
:wave: Be nice.  See [our code of conduct](CODE_OF_CONDUCT.md)
 | 
					:wave: Be nice. See [our code of conduct](CODE_OF_CONDUCT.md)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user