mirror of
https://github.com/actions/setup-node.git
synced 2025-07-23 06:58:24 +02:00
mirrorurl code
This commit is contained in:
parent
802632921f
commit
0b66095a84
6 changed files with 210 additions and 62 deletions
|
@ -25,6 +25,7 @@ export default abstract class BaseDistribution {
|
|||
}
|
||||
|
||||
protected abstract getDistributionUrl(): string;
|
||||
|
||||
|
||||
public async setupNodeJs() {
|
||||
let nodeJsVersions: INodeVersion[] | undefined;
|
||||
|
@ -128,6 +129,31 @@ export default abstract class BaseDistribution {
|
|||
};
|
||||
}
|
||||
|
||||
protected getNodejsMirrorURLInfo(version: string) {
|
||||
const mirrorURL = this.nodeInfo.mirrorURL;
|
||||
const osArch: string = this.translateArchToDistUrl(this.nodeInfo.arch);
|
||||
version = semver.clean(version) || '';
|
||||
const fileName: string =
|
||||
this.osPlat == 'win32'
|
||||
? `node-v${version}-win-${osArch}`
|
||||
: `node-v${version}-${this.osPlat}-${osArch}`;
|
||||
const urlFileName: string =
|
||||
this.osPlat == 'win32'
|
||||
? this.nodeInfo.arch === 'arm64'
|
||||
? `${fileName}.zip`
|
||||
: `${fileName}.7z`
|
||||
: `${fileName}.tar.gz`;
|
||||
|
||||
const url = `${mirrorURL}/v${version}/${urlFileName}`;
|
||||
|
||||
return <INodeVersionInfo>{
|
||||
downloadUrl: url,
|
||||
resolvedVersion: version,
|
||||
arch: osArch,
|
||||
fileName: fileName
|
||||
};
|
||||
}
|
||||
|
||||
protected async downloadNodejs(info: INodeVersionInfo) {
|
||||
let downloadPath = '';
|
||||
core.info(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue