mirror of
				https://github.com/actions/setup-node.git
				synced 2025-11-04 05:19:11 +08:00 
			
		
		
		
	Add support for nightly and rc versions (#611)
This commit is contained in:
		@@ -104,6 +104,78 @@ jobs:
 | 
			
		||||
      - run: npm test
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Nightly versions
 | 
			
		||||
 | 
			
		||||
You can specify a nightly version to download it from https://nodejs.org/download/nightly. 
 | 
			
		||||
 | 
			
		||||
### Install the nightly build for a major version
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
jobs:
 | 
			
		||||
  build:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    name: Node sample
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v3
 | 
			
		||||
      - uses: actions/setup-node@v3
 | 
			
		||||
        with:
 | 
			
		||||
          node-version: '16-nightly' # it will install the latest nightly release for node 16
 | 
			
		||||
      - run: npm ci
 | 
			
		||||
      - run: npm test
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### Install the nightly build for a specific version
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
jobs:
 | 
			
		||||
  build:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    name: Node sample
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v3
 | 
			
		||||
      - uses: actions/setup-node@v3
 | 
			
		||||
        with:
 | 
			
		||||
          node-version: '16.0.0-nightly' # it will install the latest nightly release for node 16.0.0
 | 
			
		||||
      - run: npm ci
 | 
			
		||||
      - run: npm test
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### Install an exact nightly version
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
jobs:
 | 
			
		||||
  build:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    name: Node sample
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v3
 | 
			
		||||
      - uses: actions/setup-node@v3
 | 
			
		||||
        with:
 | 
			
		||||
          node-version: '16.0.0-nightly20210420a0261d231c'
 | 
			
		||||
      - run: npm ci
 | 
			
		||||
      - run: npm test
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## RC versions
 | 
			
		||||
 | 
			
		||||
You can use specify a rc version to download it from https://nodejs.org/download/rc.
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
jobs:
 | 
			
		||||
  build:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    name: Node sample
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v3
 | 
			
		||||
      - uses: actions/setup-node@v3
 | 
			
		||||
        with:
 | 
			
		||||
          node-version: '16.0.0-rc.1'
 | 
			
		||||
      - run: npm ci
 | 
			
		||||
      - run: npm test
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
**Note:** Unlike nightly versions, which support version range specifiers, you must specify the exact version for a release candidate: `16.0.0-rc.1`.
 | 
			
		||||
 | 
			
		||||
## Caching packages data
 | 
			
		||||
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.
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user