mirror of
				https://gitea.com/actions/setup-node.git
				synced 2025-10-29 15:52:42 +08:00 
			
		
		
		
	Compare commits
	
		
			14 Commits
		
	
	
		
			v2.1.3
			...
			v-malob/up
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					1d846de8c0 | ||
| 
						 | 
					d06286dee6 | ||
| 
						 | 
					d8c1b596a6 | ||
| 
						 | 
					2bfa943ffb | ||
| 
						 | 
					6c8a6e529a | ||
| 
						 | 
					7d147e85af | ||
| 
						 | 
					66dfac5328 | ||
| 
						 | 
					312bbeecfd | ||
| 
						 | 
					26a6dcb73b | ||
| 
						 | 
					f4215cc0e0 | ||
| 
						 | 
					14e150d2b1 | ||
| 
						 | 
					5da2d61209 | ||
| 
						 | 
					a600caf7cc | ||
| 
						 | 
					8dde5bc004 | 
							
								
								
									
										2
									
								
								.github/workflows/build-test.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/build-test.yml
									
									
									
									
										vendored
									
									
								
							@@ -20,7 +20,7 @@ jobs:
 | 
				
			|||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      - uses: actions/checkout@v2
 | 
					      - uses: actions/checkout@v2
 | 
				
			||||||
      - name: Setup node 12
 | 
					      - name: Setup node 12
 | 
				
			||||||
        uses: actions/setup-node@v1
 | 
					        uses: actions/setup-node@v2
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          node-version: 12.x
 | 
					          node-version: 12.x
 | 
				
			||||||
      - run: npm ci
 | 
					      - run: npm ci
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										26
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								README.md
									
									
									
									
									
								
							@@ -10,14 +10,14 @@ This action sets by node environment for use in actions by:
 | 
				
			|||||||
- registering problem matchers for error output
 | 
					- registering problem matchers for error output
 | 
				
			||||||
- configuring authentication for GPR or npm
 | 
					- configuring authentication for GPR or npm
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# v2-beta
 | 
					# v2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
A beta release which adds reliability for pulling node distributions from a cache of node releases is available by referencing the `v2-beta` tag.
 | 
					This release adds reliability for pulling node distributions from a cache of node releases.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
steps:
 | 
					steps:
 | 
				
			||||||
- uses: actions/checkout@v2
 | 
					- uses: actions/checkout@v2
 | 
				
			||||||
- uses: actions/setup-node@v2-beta
 | 
					- uses: actions/setup-node@v2
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    node-version: '12'
 | 
					    node-version: '12'
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
@@ -34,7 +34,7 @@ Basic:
 | 
				
			|||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
steps:
 | 
					steps:
 | 
				
			||||||
- uses: actions/checkout@v2
 | 
					- uses: actions/checkout@v2
 | 
				
			||||||
- uses: actions/setup-node@v1
 | 
					- uses: actions/setup-node@v2
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    node-version: '12'
 | 
					    node-version: '12'
 | 
				
			||||||
- run: npm install
 | 
					- run: npm install
 | 
				
			||||||
@@ -47,7 +47,7 @@ Check latest version:
 | 
				
			|||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
steps:
 | 
					steps:
 | 
				
			||||||
- uses: actions/checkout@v2
 | 
					- uses: actions/checkout@v2
 | 
				
			||||||
- uses: actions/setup-node@v2-beta
 | 
					- uses: actions/setup-node@v2
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    node-version: '12'
 | 
					    node-version: '12'
 | 
				
			||||||
    check-latest: true
 | 
					    check-latest: true
 | 
				
			||||||
@@ -67,7 +67,7 @@ jobs:
 | 
				
			|||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      - uses: actions/checkout@v2
 | 
					      - uses: actions/checkout@v2
 | 
				
			||||||
      - name: Setup node
 | 
					      - name: Setup node
 | 
				
			||||||
        uses: actions/setup-node@v1
 | 
					        uses: actions/setup-node@v2
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          node-version: ${{ matrix.node }}
 | 
					          node-version: ${{ matrix.node }}
 | 
				
			||||||
      - run: npm install
 | 
					      - run: npm install
 | 
				
			||||||
@@ -86,7 +86,7 @@ jobs:
 | 
				
			|||||||
    name: Node sample
 | 
					    name: Node sample
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      - uses: actions/checkout@v2
 | 
					      - uses: actions/checkout@v2
 | 
				
			||||||
      - uses: actions/setup-node@v1
 | 
					      - uses: actions/setup-node@v2
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          node-version: '12'
 | 
					          node-version: '12'
 | 
				
			||||||
          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
 | 
				
			||||||
@@ -121,7 +121,7 @@ jobs:
 | 
				
			|||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      - uses: actions/checkout@v2
 | 
					      - uses: actions/checkout@v2
 | 
				
			||||||
      - name: Setup node
 | 
					      - name: Setup node
 | 
				
			||||||
        uses: actions/setup-node@v1
 | 
					        uses: actions/setup-node@v2
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          node-version: ${{ matrix.node_version }}
 | 
					          node-version: ${{ matrix.node_version }}
 | 
				
			||||||
          architecture: ${{ matrix.architecture }}
 | 
					          architecture: ${{ matrix.architecture }}
 | 
				
			||||||
@@ -133,7 +133,7 @@ Publish to npmjs and GPR with npm:
 | 
				
			|||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
steps:
 | 
					steps:
 | 
				
			||||||
- uses: actions/checkout@v2
 | 
					- uses: actions/checkout@v2
 | 
				
			||||||
- uses: actions/setup-node@v1
 | 
					- uses: actions/setup-node@v2
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    node-version: '10.x'
 | 
					    node-version: '10.x'
 | 
				
			||||||
    registry-url: 'https://registry.npmjs.org'
 | 
					    registry-url: 'https://registry.npmjs.org'
 | 
				
			||||||
@@ -141,7 +141,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@v1
 | 
					- uses: actions/setup-node@v2
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    registry-url: 'https://npm.pkg.github.com'
 | 
					    registry-url: 'https://npm.pkg.github.com'
 | 
				
			||||||
- run: npm publish
 | 
					- run: npm publish
 | 
				
			||||||
@@ -153,7 +153,7 @@ Publish to npmjs and GPR with yarn:
 | 
				
			|||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
steps:
 | 
					steps:
 | 
				
			||||||
- uses: actions/checkout@v2
 | 
					- uses: actions/checkout@v2
 | 
				
			||||||
- uses: actions/setup-node@v1
 | 
					- uses: actions/setup-node@v2
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    node-version: '10.x'
 | 
					    node-version: '10.x'
 | 
				
			||||||
    registry-url: <registry url>
 | 
					    registry-url: <registry url>
 | 
				
			||||||
@@ -161,7 +161,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@v1
 | 
					- uses: actions/setup-node@v2
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    registry-url: 'https://npm.pkg.github.com'
 | 
					    registry-url: 'https://npm.pkg.github.com'
 | 
				
			||||||
- run: yarn publish
 | 
					- run: yarn publish
 | 
				
			||||||
@@ -173,7 +173,7 @@ Use private packages:
 | 
				
			|||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
steps:
 | 
					steps:
 | 
				
			||||||
- uses: actions/checkout@v2
 | 
					- uses: actions/checkout@v2
 | 
				
			||||||
- uses: actions/setup-node@v1
 | 
					- uses: actions/setup-node@v2
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    node-version: '10.x'
 | 
					    node-version: '10.x'
 | 
				
			||||||
    registry-url: 'https://registry.npmjs.org'
 | 
					    registry-url: 'https://registry.npmjs.org'
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -123,4 +123,13 @@ describe('authutil tests', () => {
 | 
				
			|||||||
    expect(rc['registry']).toBe('https://registry.npmjs.org/');
 | 
					    expect(rc['registry']).toBe('https://registry.npmjs.org/');
 | 
				
			||||||
    expect(rc['always-auth']).toBe('true');
 | 
					    expect(rc['always-auth']).toBe('true');
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					  it('It is already set the NODE_AUTH_TOKEN export it ', async () => {
 | 
				
			||||||
 | 
					    process.env.NODE_AUTH_TOKEN = 'foobar';
 | 
				
			||||||
 | 
					    await auth.configAuthentication('npm.pkg.github.com', 'false');
 | 
				
			||||||
 | 
					    expect(fs.statSync(rcFile)).toBeDefined();
 | 
				
			||||||
 | 
					    let rc = readRcFile(rcFile);
 | 
				
			||||||
 | 
					    expect(rc['@ownername:registry']).toBe('npm.pkg.github.com/');
 | 
				
			||||||
 | 
					    expect(rc['always-auth']).toBe('false');
 | 
				
			||||||
 | 
					    expect(process.env.NODE_AUTH_TOKEN).toEqual('foobar');
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										4
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							@@ -4803,8 +4803,8 @@ function writeRegistryToFile(registryUrl, fileLocation, alwaysAuth) {
 | 
				
			|||||||
    newContents += `${authString}${os.EOL}${registryString}${os.EOL}${alwaysAuthString}`;
 | 
					    newContents += `${authString}${os.EOL}${registryString}${os.EOL}${alwaysAuthString}`;
 | 
				
			||||||
    fs.writeFileSync(fileLocation, newContents);
 | 
					    fs.writeFileSync(fileLocation, newContents);
 | 
				
			||||||
    core.exportVariable('NPM_CONFIG_USERCONFIG', fileLocation);
 | 
					    core.exportVariable('NPM_CONFIG_USERCONFIG', fileLocation);
 | 
				
			||||||
    // Export empty node_auth_token so npm doesn't complain about not being able to find it
 | 
					    // Export empty node_auth_token if didn't exist so npm doesn't complain about not being able to find it
 | 
				
			||||||
    core.exportVariable('NODE_AUTH_TOKEN', 'XXXXX-XXXXX-XXXXX-XXXXX');
 | 
					    core.exportVariable('NODE_AUTH_TOKEN', process.env.NODE_AUTH_TOKEN || 'XXXXX-XXXXX-XXXXX-XXXXX');
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
//# sourceMappingURL=authutil.js.map
 | 
					//# sourceMappingURL=authutil.js.map
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -53,6 +53,9 @@ function writeRegistryToFile(
 | 
				
			|||||||
  newContents += `${authString}${os.EOL}${registryString}${os.EOL}${alwaysAuthString}`;
 | 
					  newContents += `${authString}${os.EOL}${registryString}${os.EOL}${alwaysAuthString}`;
 | 
				
			||||||
  fs.writeFileSync(fileLocation, newContents);
 | 
					  fs.writeFileSync(fileLocation, newContents);
 | 
				
			||||||
  core.exportVariable('NPM_CONFIG_USERCONFIG', fileLocation);
 | 
					  core.exportVariable('NPM_CONFIG_USERCONFIG', fileLocation);
 | 
				
			||||||
  // Export empty node_auth_token so npm doesn't complain about not being able to find it
 | 
					  // Export empty node_auth_token if didn't exist so npm doesn't complain about not being able to find it
 | 
				
			||||||
  core.exportVariable('NODE_AUTH_TOKEN', 'XXXXX-XXXXX-XXXXX-XXXXX');
 | 
					  core.exportVariable(
 | 
				
			||||||
 | 
					    'NODE_AUTH_TOKEN',
 | 
				
			||||||
 | 
					    process.env.NODE_AUTH_TOKEN || 'XXXXX-XXXXX-XXXXX-XXXXX'
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user