github: use github token to download releases with actions/tool-cache if available
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
@@ -36,13 +36,16 @@ import {GitHubRelease} from '../types/github';
|
|||||||
|
|
||||||
export interface InstallOpts {
|
export interface InstallOpts {
|
||||||
standalone?: boolean;
|
standalone?: boolean;
|
||||||
|
githubToken?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Install {
|
export class Install {
|
||||||
private readonly standalone: boolean | undefined;
|
private readonly standalone: boolean | undefined;
|
||||||
|
private readonly githubToken: string | undefined;
|
||||||
|
|
||||||
constructor(opts?: InstallOpts) {
|
constructor(opts?: InstallOpts) {
|
||||||
this.standalone = opts?.standalone;
|
this.standalone = opts?.standalone;
|
||||||
|
this.githubToken = opts?.githubToken || process.env.GITHUB_TOKEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -83,7 +86,7 @@ export class Install {
|
|||||||
const downloadURL = util.format(version.downloadURL, vspec, this.filename(vspec));
|
const downloadURL = util.format(version.downloadURL, vspec, this.filename(vspec));
|
||||||
core.info(`Downloading ${downloadURL}`);
|
core.info(`Downloading ${downloadURL}`);
|
||||||
|
|
||||||
const htcDownloadPath = await tc.downloadTool(downloadURL);
|
const htcDownloadPath = await tc.downloadTool(downloadURL, undefined, this.githubToken);
|
||||||
core.debug(`Install.download htcDownloadPath: ${htcDownloadPath}`);
|
core.debug(`Install.download htcDownloadPath: ${htcDownloadPath}`);
|
||||||
|
|
||||||
const cacheSavePath = await installCache.save(htcDownloadPath);
|
const cacheSavePath = await installCache.save(htcDownloadPath);
|
||||||
|
|||||||
@@ -32,13 +32,16 @@ import {GitHubRelease} from '../types/github';
|
|||||||
|
|
||||||
export interface InstallOpts {
|
export interface InstallOpts {
|
||||||
standalone?: boolean;
|
standalone?: boolean;
|
||||||
|
githubToken?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Install {
|
export class Install {
|
||||||
private readonly standalone: boolean | undefined;
|
private readonly standalone: boolean | undefined;
|
||||||
|
private readonly githubToken: string | undefined;
|
||||||
|
|
||||||
constructor(opts?: InstallOpts) {
|
constructor(opts?: InstallOpts) {
|
||||||
this.standalone = opts?.standalone;
|
this.standalone = opts?.standalone;
|
||||||
|
this.githubToken = opts?.githubToken || process.env.GITHUB_TOKEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -79,7 +82,7 @@ export class Install {
|
|||||||
const downloadURL = util.format(version.downloadURL, vspec, this.filename());
|
const downloadURL = util.format(version.downloadURL, vspec, this.filename());
|
||||||
core.info(`Downloading ${downloadURL}`);
|
core.info(`Downloading ${downloadURL}`);
|
||||||
|
|
||||||
const htcDownloadPath = await tc.downloadTool(downloadURL);
|
const htcDownloadPath = await tc.downloadTool(downloadURL, undefined, this.githubToken);
|
||||||
core.debug(`Install.download htcDownloadPath: ${htcDownloadPath}`);
|
core.debug(`Install.download htcDownloadPath: ${htcDownloadPath}`);
|
||||||
|
|
||||||
const cacheSavePath = await installCache.save(htcDownloadPath);
|
const cacheSavePath = await installCache.save(htcDownloadPath);
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ export interface InstallOpts {
|
|||||||
|
|
||||||
regctl?: Regctl;
|
regctl?: Regctl;
|
||||||
undock?: Undock;
|
undock?: Undock;
|
||||||
|
|
||||||
|
githubToken?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface LimaImage {
|
interface LimaImage {
|
||||||
@@ -80,6 +82,7 @@ export class Install {
|
|||||||
private readonly localTCPPort?: number;
|
private readonly localTCPPort?: number;
|
||||||
private readonly regctl: Regctl;
|
private readonly regctl: Regctl;
|
||||||
private readonly undock: Undock;
|
private readonly undock: Undock;
|
||||||
|
private readonly githubToken?: string;
|
||||||
|
|
||||||
private _version: string | undefined;
|
private _version: string | undefined;
|
||||||
private _toolDir: string | undefined;
|
private _toolDir: string | undefined;
|
||||||
@@ -101,6 +104,7 @@ export class Install {
|
|||||||
this.localTCPPort = opts.localTCPPort;
|
this.localTCPPort = opts.localTCPPort;
|
||||||
this.regctl = opts.regctl || new Regctl();
|
this.regctl = opts.regctl || new Regctl();
|
||||||
this.undock = opts.undock || new Undock();
|
this.undock = opts.undock || new Undock();
|
||||||
|
this.githubToken = opts.githubToken || process.env.GITHUB_TOKEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
get toolDir(): string {
|
get toolDir(): string {
|
||||||
@@ -211,7 +215,7 @@ export class Install {
|
|||||||
const downloadURL = this.downloadURL(component, this._version, src.channel);
|
const downloadURL = this.downloadURL(component, this._version, src.channel);
|
||||||
core.info(`Downloading ${downloadURL}`);
|
core.info(`Downloading ${downloadURL}`);
|
||||||
|
|
||||||
const downloadPath = await tc.downloadTool(downloadURL);
|
const downloadPath = await tc.downloadTool(downloadURL, undefined, this.githubToken);
|
||||||
core.debug(`docker.Install.downloadSourceArchive downloadPath: ${downloadPath}`);
|
core.debug(`docker.Install.downloadSourceArchive downloadPath: ${downloadPath}`);
|
||||||
|
|
||||||
let extractFolder;
|
let extractFolder;
|
||||||
|
|||||||
@@ -29,7 +29,17 @@ import {GitHub} from '../github';
|
|||||||
import {GitHubRelease} from '../types/github';
|
import {GitHubRelease} from '../types/github';
|
||||||
import {DownloadVersion} from '../types/regclient/regclient';
|
import {DownloadVersion} from '../types/regclient/regclient';
|
||||||
|
|
||||||
|
export interface InstallOpts {
|
||||||
|
githubToken?: string;
|
||||||
|
}
|
||||||
|
|
||||||
export class Install {
|
export class Install {
|
||||||
|
private readonly githubToken: string | undefined;
|
||||||
|
|
||||||
|
constructor(opts?: InstallOpts) {
|
||||||
|
this.githubToken = opts?.githubToken || process.env.GITHUB_TOKEN;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Download regclient binary from GitHub release
|
* Download regclient binary from GitHub release
|
||||||
* @param v: version semver version or latest
|
* @param v: version semver version or latest
|
||||||
@@ -68,7 +78,7 @@ export class Install {
|
|||||||
const downloadURL = util.format(version.downloadURL, vspec, this.filename());
|
const downloadURL = util.format(version.downloadURL, vspec, this.filename());
|
||||||
core.info(`Downloading ${downloadURL}`);
|
core.info(`Downloading ${downloadURL}`);
|
||||||
|
|
||||||
const htcDownloadPath = await tc.downloadTool(downloadURL);
|
const htcDownloadPath = await tc.downloadTool(downloadURL, undefined, this.githubToken);
|
||||||
core.debug(`Install.download htcDownloadPath: ${htcDownloadPath}`);
|
core.debug(`Install.download htcDownloadPath: ${htcDownloadPath}`);
|
||||||
|
|
||||||
const cacheSavePath = await installCache.save(htcDownloadPath);
|
const cacheSavePath = await installCache.save(htcDownloadPath);
|
||||||
|
|||||||
@@ -29,7 +29,17 @@ import {GitHub} from '../github';
|
|||||||
import {GitHubRelease} from '../types/github';
|
import {GitHubRelease} from '../types/github';
|
||||||
import {DownloadVersion} from '../types/undock/undock';
|
import {DownloadVersion} from '../types/undock/undock';
|
||||||
|
|
||||||
|
export interface InstallOpts {
|
||||||
|
githubToken?: string;
|
||||||
|
}
|
||||||
|
|
||||||
export class Install {
|
export class Install {
|
||||||
|
private readonly githubToken: string | undefined;
|
||||||
|
|
||||||
|
constructor(opts?: InstallOpts) {
|
||||||
|
this.githubToken = opts?.githubToken || process.env.GITHUB_TOKEN;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Download undock binary from GitHub release
|
* Download undock binary from GitHub release
|
||||||
* @param v: version semver version or latest
|
* @param v: version semver version or latest
|
||||||
@@ -68,7 +78,7 @@ export class Install {
|
|||||||
const downloadURL = util.format(version.downloadURL, vspec, this.filename(vspec));
|
const downloadURL = util.format(version.downloadURL, vspec, this.filename(vspec));
|
||||||
core.info(`Downloading ${downloadURL}`);
|
core.info(`Downloading ${downloadURL}`);
|
||||||
|
|
||||||
const htcDownloadPath = await tc.downloadTool(downloadURL);
|
const htcDownloadPath = await tc.downloadTool(downloadURL, undefined, this.githubToken);
|
||||||
core.debug(`Install.download htcDownloadPath: ${htcDownloadPath}`);
|
core.debug(`Install.download htcDownloadPath: ${htcDownloadPath}`);
|
||||||
|
|
||||||
let htcExtPath: string;
|
let htcExtPath: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user