mirror of
https://github.com/actions/setup-node.git
synced 2026-03-07 06:51:46 +08:00
Compare commits
2 Commits
018279a706
...
380cf08b3f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
380cf08b3f | ||
|
|
6e3e989fb8 |
@ -449,7 +449,7 @@ describe('setup-node', () => {
|
||||
}
|
||||
}, 100000);
|
||||
|
||||
it('acquires specified architecture of node from mirror', async () => {
|
||||
it('acquires specified architecture of node', async () => {
|
||||
for (const { arch, version, osSpec } of [
|
||||
{
|
||||
arch: 'x86',
|
||||
|
||||
@ -106,10 +106,7 @@ export default abstract class BaseDistribution {
|
||||
headers['Authorization'] = `Bearer ${this.nodeInfo.mirrorToken}`;
|
||||
}
|
||||
|
||||
const response = await this.httpClient.getJson<INodeVersion[]>(
|
||||
dataUrl,
|
||||
headers
|
||||
);
|
||||
const response = await this.httpClient.getJson<INodeVersion[]>(dataUrl, headers);
|
||||
return response.result || [];
|
||||
}
|
||||
|
||||
@ -143,11 +140,7 @@ export default abstract class BaseDistribution {
|
||||
`Acquiring ${info.resolvedVersion} - ${info.arch} from ${info.downloadUrl}`
|
||||
);
|
||||
try {
|
||||
downloadPath = await tc.downloadTool(
|
||||
info.downloadUrl,
|
||||
undefined,
|
||||
this.nodeInfo.mirrorToken
|
||||
);
|
||||
downloadPath = await tc.downloadTool(info.downloadUrl, undefined, this.nodeInfo.mirrorToken);
|
||||
} catch (err) {
|
||||
if (
|
||||
err instanceof tc.HTTPError &&
|
||||
@ -198,34 +191,18 @@ export default abstract class BaseDistribution {
|
||||
|
||||
core.info(`Downloading only node binary from ${exeUrl}`);
|
||||
|
||||
const exePath = await tc.downloadTool(
|
||||
exeUrl,
|
||||
undefined,
|
||||
this.nodeInfo.mirrorToken
|
||||
);
|
||||
const exePath = await tc.downloadTool(exeUrl, undefined, this.nodeInfo.mirrorToken);
|
||||
await io.cp(exePath, path.join(tempDir, 'node.exe'));
|
||||
const libPath = await tc.downloadTool(
|
||||
libUrl,
|
||||
undefined,
|
||||
this.nodeInfo.mirrorToken
|
||||
);
|
||||
const libPath = await tc.downloadTool(libUrl, undefined, this.nodeInfo.mirrorToken);
|
||||
await io.cp(libPath, path.join(tempDir, 'node.lib'));
|
||||
} catch (err) {
|
||||
if (err instanceof tc.HTTPError && err.httpStatusCode == 404) {
|
||||
exeUrl = `${initialUrl}/v${version}/node.exe`;
|
||||
libUrl = `${initialUrl}/v${version}/node.lib`;
|
||||
|
||||
const exePath = await tc.downloadTool(
|
||||
exeUrl,
|
||||
undefined,
|
||||
this.nodeInfo.mirrorToken
|
||||
);
|
||||
const exePath = await tc.downloadTool(exeUrl, undefined, this.nodeInfo.mirrorToken);
|
||||
await io.cp(exePath, path.join(tempDir, 'node.exe'));
|
||||
const libPath = await tc.downloadTool(
|
||||
libUrl,
|
||||
undefined,
|
||||
this.nodeInfo.mirrorToken
|
||||
);
|
||||
const libPath = await tc.downloadTool(libUrl, undefined, this.nodeInfo.mirrorToken);
|
||||
await io.cp(libPath, path.join(tempDir, 'node.lib'));
|
||||
} else {
|
||||
throw err;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user